/** * Tests the JApplicationWeb::triggerEvents method. * * @return void * * @since 11.3 */ public function testTriggerEvents() { $this->inspector->setClassProperty('dispatcher', null); $this->assertThat($this->inspector->triggerEvent('onJWebTriggerEvent'), $this->isNull(), 'Checks that for a non-dispatcher object, null is returned.'); $this->inspector->setClassProperty('dispatcher', $this->getMockDispatcher()); $this->inspector->registerEvent('onJWebTriggerEvent', 'function'); $this->assertThat($this->inspector->triggerEvent('onJWebTriggerEvent'), $this->equalTo(array('function' => null)), 'Checks the correct dispatcher method is called.'); }
/** * Tests the JApplicationWeb::registerEvent method. * * @return void * * @since 11.3 */ public function testRegisterEvent() { TestReflection::setValue($this->class, 'dispatcher', $this->getMockDispatcher()); $this->assertThat( $this->class->registerEvent('onJWebRegisterEvent', 'function'), $this->identicalTo($this->class), 'Check chaining.' ); $this->assertArrayHasKey( 'onJWebRegisterEvent', TestMockDispatcher::$handlers, 'Checks the events were passed to the mock dispatcher.' ); }