Exemplo n.º 1
0
 public function testLazyProperty()
 {
     $obj = new Prototype();
     $obj->a = Prototype::lazy(function () {
         return rand();
     });
     $this->assertEquals($obj->a, $obj->a);
     $obj->a = Prototype::lazy(function () use($obj) {
         return $this === $obj;
     });
     $this->assertTrue($obj->a);
     $obj->a = Prototype::lazy('phpversion');
     $this->assertEquals($obj->a, phpversion());
 }