예제 #1
0
 /**
  * Tests the JApplicationBase::loadDispatcher method.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function testLoadDispatcher()
 {
     $this->class->loadDispatcher($this->getMockDispatcher());
     $this->assertAttributeInstanceOf('JEventDispatcher', 'dispatcher', $this->class);
     // Inject a mock value into the JEventDispatcher singleton.
     TestReflection::setValue('JEventDispatcher', 'instance', 'foo');
     $this->class->loadDispatcher();
     $this->assertEquals('foo', TestReflection::getValue($this->class, 'dispatcher'));
 }
 /**
  * @testdox  Tests that an event is triggered with the application dispatcher.
  *
  * @covers  JApplicationBase::triggerEvent
  * @uses    JApplicationBase::loadDispatcher
  * @uses    JApplicationBase::registerEvent
  */
 public function testTriggerEvent()
 {
     // Inject the mock dispatcher into the application
     $this->class->loadDispatcher($this->getMockDispatcher());
     // Register our event to be triggered
     $this->class->registerEvent('onJApplicationBaseTriggerEvent', 'function');
     // Validate the event was triggered
     $this->assertSame(array('function' => null), $this->class->triggerEvent('onJApplicationBaseTriggerEvent'));
 }