private function buildKernel(Request $request, RouteCollection $collection) { $kernel = new AppKernel('dev'); $kernel->listen($request); $kernel->addListenerOnce(KernelEvents::BOOTED, array($this, 'onBooted'), 10); $kernel->addListenerOnce(KernelEvents::REQUEST, array(new RouterListener($collection), 'onRequest')); return $kernel; }
public function testBuildConfig() { $kernel = new AppKernel('prod'); $kernel->boot(); /** @var Configuration $config */ $config = $kernel->getContainer()->get('config'); $resolver = $kernel->getContainer()->getParameterBag()->getResolver(); $expected = array('port' => 5432, 'locale' => 'id', 'router' => array('home' => array('path' => '/', 'controller' => 'DemoBundle:Default:index'), 'demo' => array('app.login' => array('path' => '/login', 'controller' => 'DemoBundle:LoginController:login'), 'app.logout' => array('path' => '/logout', 'controller' => 'DemoBundle:LoginController:logout'), 'prefix' => '/demo'))); $this->assertInstanceOf('\\Borobudur\\Config\\Configuration', $config); $this->assertSame($expected, $resolver->resolveValue($config->get('demo'))); }