public function testInvalidHandler2() { $this->component->onMyEvent = array($this->component, 'nullHandler'); try { $this->component->onMyEvent(); } catch (Exception $e) { $this->assertInstanceOf('CException', $e); $this->assertSame('Event "NewComponent.onmyevent" is attached with an invalid handler "nullHandler".', $e->getMessage()); } }
public function testStopEvent() { $component = new NewComponent(); $component->onMyEvent = 'globalEventHandler2'; $component->onMyEvent = array($this->component, 'myEventHandler'); $component->onMyEvent(); $this->assertTrue($component->eventHandled); $this->assertFalse($this->component->eventHandled); }