示例#1
0
 public function testGetDIContainer()
 {
     require __DIR__ . '/TestService.php';
     $app = \jakulov\Corpuscle\Core\App::getInstance(['app' => 'test', 'service' => ['test' => ['class' => 'TestService', 'args' => [':app']]]]);
     /** @var \TestService $service */
     $service = $app->getService('service.test');
     $this->assertEquals($service->test, 'test');
 }
示例#2
0
 public function testLoad()
 {
     $config = \jakulov\Corpuscle\Core\Config::load(__DIR__ . '/config', 'test');
     $this->assertEquals('test', $config['app']['env']);
     $this->assertEquals('bar', $config['app']['foo']);
     $this->assertEquals(__DIR__ . '/config/test', $config['app']['dev_test']);
     $app = \jakulov\Corpuscle\Core\App::getInstance($config);
     $this->assertEquals('test', $app->getEnvironment());
 }
 public function testRun()
 {
     $app = \jakulov\Corpuscle\Core\App::getInstance([]);
     $request = \Symfony\Component\HttpFoundation\Request::create('/', 'POST');
     $ok = $app->handleHttpRequest($request, false);
     $this->assertEquals(true, $ok instanceof \Symfony\Component\HttpFoundation\Response);
     $this->assertEquals(true, stripos($ok->getContent(), 'Unknown action') !== false);
     $this->assertEquals(404, $ok->getStatusCode());
 }