/** * Constructor * * @param ServiceContainer container * @param ApplicationInterface $app * @param ControllerResolverInterface $resolver */ public function __construct(ServiceContainer $container, ApplicationInterface $app, ControllerResolverInterface $resolver) { $this->container = $container; $this->resolver = $resolver; $this->container->setApp($app); $this->loadConfig()->loadRouting(); $this->container->setConfig($app->getConfig()); $this->dispatchEvent(KernelEvents::APP_LOADED, new KernelEvent($container)); $this->container['kernel'] = $this; parent::__construct($this->container['core']['dispatcher'], $resolver); }
public function testRegister() { $config = new Config(); $container = new ServiceContainer(); $container->setConfig($config); $params = array('dbname' => 'DBNAME', 'user' => 'USER', 'password' => 'PWD', 'host' => '', 'driver' => 'oci8'); $config = new Configuration(); $connection = DriverManager::getConnection($params, $config); $values = array('doctrine.connection' => $connection); $container->register(new ServiceCommandProvider(), $values); $this->assertEquals($connection, $container['doctrine.connection']); }
public function testRegister() { $container = new ServiceContainer(); $container->setConfig(new Config()); $container->register(new ServiceProvider()); // collectors $this->assertInstanceOf('Itkg\\Debug\\DataCollector\\CacheDataCollector', $container['debug']['collector.cache']); $this->assertInstanceOf('Itkg\\Debug\\DataCollector\\ConfigDataCollector', $container['debug']['collector.config']); $this->assertInstanceOf('Itkg\\Debug\\DataCollector\\RouteDataCollector', $container['debug']['collector.route']); $this->assertInstanceOf('Itkg\\Debug\\DataCollector\\DatabaseDataCollector', $container['debug']['collector.db']); // bar $this->assertInstanceOf('DebugBar\\StandardDebugBar', $container['debug']['bar']); // renderer $this->assertInstanceOf('DebugBar\\JavascriptRenderer', $container['debug']['renderer']); }