Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 public function testDetachingBehaviors()
 {
     $behavior = new NewBehavior();
     $this->component->attachBehavior('newBehavior', $behavior);
     $this->component->detachBehaviors();
     try {
         $this->component->test();
     } catch (Exception $e) {
         $this->assertInstanceOf('CException', $e);
         $this->assertSame('NewComponent and its behaviors do not have a method or closure named "test".', $e->getMessage());
     }
 }
Exemplo n.º 3
0
 public function testDetachingBehaviors()
 {
     $component = new NewComponent();
     $behavior = new NewBehavior();
     $component->attachBehavior('a', $behavior);
     $component->detachBehaviors();
     $this->setExpectedException('CException');
     $component->test();
 }