protected function makeModel($a, $b)
 {
     $zz = new ZZ();
     $zz->a = $a;
     $zz->b = $b;
     $this->assertTrue($zz->save());
 }
Пример #2
0
 public function testMoeda()
 {
     $moeda = ZZ::moeda();
     foreach ($moeda as $submoeda) {
         $this->miniTesteMoeda($submoeda);
     }
 }
Пример #3
0
 public function testContaPalavra()
 {
     $f = "testecontapalvra.txt";
     exec("printf \"palavra\nprimeiro\nsegundo\ncod\ncodi\ncodigo\n\" > {$f}");
     if (is_file($f)) {
         $this->assertEquals(1, (int) ZZ::contapalavra($f, 'palavra', true, true)->toString());
         $this->assertEquals(1, (int) ZZ::contapalavra($f, 'palavra', false, true)->toString());
         $this->assertEquals(1, (int) ZZ::contapalavra($f, 'palavra', true, false)->toString());
         $this->assertEquals(1, (int) ZZ::contapalavra($f, 'palavra')->toString());
         $this->assertEquals(3, (int) ZZ::contapalavra($f, 'cod', false, true)->toString());
         unlink($f);
     }
 }
Пример #4
0
    static $x = 0;
    echo "warn\n";
    if ($x++ == 1) {
        throw new exception('z');
    }
}
set_error_handler('y');
class ZZ
{
    private $asd;
    function __construct()
    {
        unset($this->asd);
    }
    function __get($z)
    {
        echo "get\n";
        return new stdclass();
    }
    static function x(ZZ $x)
    {
        try {
            $x->asd->asd->asd->asd->asd->asd->asd = 2;
            echo "ok\n";
        } catch (exception $z) {
            var_dump($x);
        }
    }
}
ZZ::x(new ZZ());