/** * Tests the JDispatcher::getInstance method. * * @return void * * @since 11.3 */ public function testGetInstance() { $mock = JDispatcher::getInstance(); $this->assertInstanceOf('JDispatcherInspector', $mock); $this->object->setInstance(null); $instance = JDispatcher::getInstance(); $this->assertInstanceOf('JDispatcher', $instance, 'Tests that getInstance returns a JDispatcher object.'); // Push a new instance into the class. JDispatcherInspector::setInstance('foo'); $this->assertThat(JDispatcher::getInstance(), $this->equalTo('foo'), 'Tests that a subsequent call to JDispatcher::getInstance returns the cached singleton.'); JDispatcherInspector::setInstance($mock); }