Пример #1
0
 public function prepareData()
 {
     $f1 = new MyFoo();
     $f1->name = 'jwage';
     $f1->value0 = 0;
     $f1->save();
     $f2 = new MyFoo();
     $f2->name = 'jonwage';
     $f2->value0 = 1;
     $f2->save();
     $f3 = new MyFoo();
     $f3->name = 'jonathanwage';
     $f3->value0 = 2;
     $f3->save();
 }
Пример #2
0
require "tests.php";
require "director_abstract.php";
// No new functions
check::functions(array(foo_ping, foo_pong, example0_getxsize, example0_color, example0_get_color, example1_getxsize, example1_color, example1_get_color, example2_getxsize, example2_color, example2_get_color, example4_getxsize, example4_color, example4_get_color, example3_i_color, example3_i_get_color, g, a_f));
// No new classes
check::classes(array(director_abstract, Foo, Example0, Example1, Example2, Example4, Example3_i, A));
// now new vars
check::globals(array());
class MyFoo extends Foo
{
    function ping()
    {
        return "MyFoo::ping()";
    }
}
$a = new MyFoo();
check::equal($a->ping(), "MyFoo::ping()", "MyFoo::ping failed");
check::equal($a->pong(), "Foo::pong();MyFoo::ping()", "MyFoo::pong failed");
class MyExample1 extends Example1
{
    function Color($r, $g, $b)
    {
        return $r;
    }
}
class MyExample2 extends Example1
{
    function Color($r, $g, $b)
    {
        return $g;
    }
Пример #3
0
        return $arg;
    }
    function vident($v)
    {
        return $v;
    }
    function vidents($v)
    {
        return $v;
    }
    function vsecond($v1, $v2)
    {
        return $v2;
    }
}
$a = new MyFoo();
$a->tping("hello");
$a->tpong("hello");
# TODO: automatic conversion between PHP arrays and std::pair or
# std::vector is not yet implemented.
/*$p = array(1, 2);
$a->pident($p);
$v = array(3, 4);
$a->vident($v);

$a->tpident($p);
$a->tvident($v);

$v1 = array(3, 4);
$v2 = array(5, 6);
Пример #4
0
<?php

require "tests.php";
require "director_enum.php";
// No new functions
check::functions(array(foo_say_hello, foo_say_hi, foo_say_bye, foo_say_hi_ref, foo_ping, foo_ping_ref, foo_ping_member_enum, a_f, a2_f));
// No new classes
check::classes(array(director_enum, Foo, A, B, A2, B2));
// now new vars
check::globals(array());
class MyFoo extends Foo
{
    function say_hi($val)
    {
        return $val;
    }
}
$b = new Foo();
$a = new MyFoo();
check::equal($a->say_hi(director_enum::hello), $b->say_hello(director_enum::hi), "say failed");
check::done();