public function tearDown() { /** * Reset the stubbed out Config object */ SingletonMock::cleanUp('Flint\\Config'); }
public function testSharedServiceWithArgLoadedCorrectly() { \Flint\App::getInstance(['options' => ['debug' => true], 'core' => ['configDir' => __DIR__ . '/../data']]); $serviceConfig = ['Fake' => ['class' => 'SharedServiceWithArgs', 'arguments' => ['Josh'], 'share' => true]]; // Stub out the loadServices method so we isolate the parsing $stub = $this->getMockBuilder('Flint\\ServiceParser')->setConstructorArgs(['fakefile.php'])->setMethods(['loadServices'])->getMock(); $stub->expects($this->any())->method('loadServices')->will($this->returnValue($stub)); SingletonMock::inject($stub, 'Flint\\ServiceParser'); $stub->loadServices()->setServices($serviceConfig); $result = $stub->parse(); $this->assertArrayHasKey('Fake', $result); $time = $result['Fake']->getTime(); $this->assertEquals('Josh', $result['Fake']->getName()); $this->assertEquals($time, $result['Fake']->getTime()); SingletonMock::cleanUp('Flint\\ServiceParser'); }