public function testDisableBehaviors()
 {
     $component = new NewComponent();
     $component->attachBehavior('a', new NewBehavior());
     $component->disableBehaviors();
     $this->setExpectedException('CException');
     // test should not be called since behavior is disabled
     echo $component->test();
 }
Exemple #2
0
 public function testAsa()
 {
     $component = new NewComponent();
     $behavior = new NewBehavior();
     $component->attachBehavior('a', $behavior);
     $this->assertSame($behavior, $component->asa('a'));
 }
 public function testAsa()
 {
     $behavior = new NewBehavior();
     $this->component->attachBehavior('newBehavior', $behavior);
     $this->assertSame($behavior, $this->component->asa('newBehavior'));
 }
 public function testBehavior()
 {
     $component = new NewComponent();
     $component->attachBehavior('a', new NewBehavior());
     $this->assertFalse($component->behaviorCalled);
     $this->assertFalse(method_exists($component, 'test'));
     $this->assertEquals(2, $component->test());
     $this->assertTrue($component->behaviorCalled);
     $this->setExpectedException('CException');
     $component->test2();
 }