예제 #1
0
 public function testConfigInstanceOfConfig()
 {
     $kernel = new TestKernel($this->env);
     $kernel->boot();
     $this->assertInstanceOf(Config::class, $kernel->getConfig());
     return $kernel;
 }
 /**
  * @param DiInterface $di
  * @return ServiceLoader
  */
 private function getServiceLoader(DiInterface $di)
 {
     $kernel = new TestKernel('ololo');
     $kernel->setDI($di);
     $kernel->setConfigPath(__DIR__ . '/Fixtures/config.php');
     $kernel->boot();
     return new ServiceLoader($kernel);
 }
 /**
  * @expectedException \Phalcon\Mvc\Dispatcher\Exception
  */
 public function testApplicationWithNotFoundRoute()
 {
     $appKernel = new TestKernel('dev');
     $appKernel->boot();
     $application = new Application($appKernel->getDI());
     ob_end_clean();
     // application don't close output buffer after exception
     $application->handle('/asdasd111');
 }
예제 #4
0
 public function testModuleLoadedViaKernel()
 {
     $di = new Di();
     $kernel = new TestKernel('dev');
     $kernel->setDI($di);
     $kernel->setConfigPath(__DIR__ . '/Fixtures/null_config.php');
     $kernel->setModules(array(new ModuleFixture($kernel)));
     $kernel->boot();
     $this->assertTrue($di->has('MyTestService'));
     $this->assertInstanceOf(ServiceInstance::class, $di->get('MyTestService'));
     /* @var $instance ServiceInstance */
     $instance = $di->get('MyTestService');
     $this->assertEquals('valueA', $instance->getParamA());
     $this->assertEquals('valueB', $instance->getParamB());
     $this->assertEquals('valueC', $instance->getParamC());
     $this->assertEquals('valueD', $instance->getParamD());
     $this->assertEquals('valueE', $instance->getParamE());
 }