/** * Test env */ public function testEnv() { $this->assertTrue($this->app->isDev()); $this->assertEquals(Application::ENV_DEV, $this->app->getEnv()); $this->app = new Application(Application::ENV_PREPROD); $this->assertFalse($this->app->isDev()); }
public function testConstruct() { $stub = $this->getMock('Itkg\\Core\\KernelAbstract', array('loadRouting', 'loadConfig', 'dispatchEvent'), array(), '', false); $stub->expects($this->any())->method('loadConfig')->will($this->returnValue($stub)); $stub->expects($this->once())->method('dispatchEvent'); $mockContainer = $this->getMock('Itkg\\Core\\ServiceContainer'); $mockContainer->expects($this->any())->method('offsetGet')->will($this->returnCallback(function ($key) { if ($key == 'core') { return array('dispatcher' => new EventDispatcher()); } })); $app = new Application(); $config = new Config(); $app->setConfig($config); $mockContainer->expects($this->once())->method('setApp')->with($app); $mockContainer->expects($this->once())->method('setConfig')->with($app->getConfig()); $mockContainer->expects($this->once())->method('offsetSet')->with('kernel', $stub); $stub->__construct($mockContainer, $app, new ControllerResolver($mockContainer)); $this->assertEquals($mockContainer, $stub->getContainer()); }
protected function setUp() { $this->application = new Application(); $this->config = new Config(array(TEST_BASE_DIR . '/data/config/config.yml')); $this->application->setConfig($this->config); }