コード例 #1
0
 public function testConfigInstanceOfConfig()
 {
     $kernel = new TestKernel($this->env);
     $kernel->boot();
     $this->assertInstanceOf(Config::class, $kernel->getConfig());
     return $kernel;
 }
コード例 #2
0
 /**
  * @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);
 }
コード例 #3
0
 /**
  * @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());
 }