コード例 #1
0
ファイル: EntityTest.php プロジェクト: WarToaster/HangOn
 public function testMethodDispatch()
 {
     $entity = new Entity(array('model' => $this->_model, 'data' => array('foo' => true)));
     $this->assertTrue($entity->validates());
     $this->expectException("/^No model bound or unhandled method call `foo`.\$/");
     $entity->foo();
 }
コード例 #2
0
ファイル: EntityTest.php プロジェクト: rmarscher/lithium
 public function testMethodDispatch()
 {
     $model = $this->_model;
     $entity = new Entity(array('model' => $model, 'data' => array('foo' => true)));
     $this->assertTrue($entity->validates());
     $model::instanceMethods(array('testInstanceMethod' => function ($entity) {
         return 'testInstanceMethod';
     }));
     $this->assertEqual('testInstanceMethod', $entity->testInstanceMethod($entity));
     $this->expectException("/^No model bound or unhandled method call `foo`.\$/");
     $entity->foo();
 }
コード例 #3
0
ファイル: EntityTest.php プロジェクト: unionofrad/lithium
 public function testMethodDispatch()
 {
     $model = $this->_model;
     $data = array('foo' => true);
     $entity = new Entity(compact('model', 'data'));
     $this->assertTrue($entity->validates());
     $model::instanceMethods(array('testInstanceMethod' => function ($entity) {
         return 'testInstanceMethod';
     }));
     $this->assertEqual('testInstanceMethod', $entity->testInstanceMethod($entity));
     $this->assertException("/^Unhandled method call `foo`.\$/", function () use($entity) {
         $entity->foo();
     });
 }