/**
  * @covers phpDocumentor\Event\Dispatcher::setInstance
  * @covers phpDocumentor\Event\Dispatcher::getInstance
  */
 public function testInstancesCanBeOverridden()
 {
     $fixture = Dispatcher::getInstance('mine');
     $this->assertSame($fixture, Dispatcher::getInstance('mine'));
     $newObject = m::mock('phpDocumentor\\Event\\Dispatcher');
     Dispatcher::setInstance('mine', $newObject);
     $this->assertSame($newObject, Dispatcher::getInstance('mine'));
 }
Esempio n. 2
0
 /**
  * Initializes a default fixture with the parser dependency.
  */
 protected function setUp()
 {
     // override dispatcher, we do not want to test this by default
     $this->dispatcherMock = m::mock('phpDocumentor\\Event\\Dispatcher')->shouldIgnoreMissing();
     Dispatcher::setInstance('default', $this->dispatcherMock);
     $this->parserMock = m::mock('phpDocumentor\\Parser\\Parser');
     $this->fixture = new File($this->parserMock);
 }