getContainer() public method

Gets API Container
public getContainer ( ) : Container
return Scalr\DependencyInjection\Container Returns DI Container instance
Example #1
0
 /**
  * @test
  */
 public function testConstructor()
 {
     $this->assertInstanceOf('Scalr\\DependencyInjection\\Container', $this->app->getContainer());
     $this->assertInstanceOf('Scalr\\DependencyInjection\\ApiContainer', $this->app->getContainer()->api);
     $this->assertEquals($this->app->getContainer()->api->router, $this->app->router);
     $this->assertInstanceOf(self::getApiClass('Routing\\Router'), $this->app->getContainer()->api->router);
     $this->assertInstanceOf(self::getApiClass('Environment'), $this->app->environment);
     $this->assertInstanceOf(self::getApiClass('Http\\Request'), $this->app->request);
     $this->assertInstanceOf(self::getApiClass('Http\\Response'), $this->app->response);
 }
Example #2
0
 /**
  * @test
  */
 public function testError()
 {
     $this->app->getContainer()->apilogger->setIsEnabled(false);
     try {
         $this->app->error();
         $this->assertTrue(false, 'app->error() should throw StopException');
     } catch (StopException $e) {
         $this->assertTrue(true);
         $this->assertEquals(500, $this->app->response->getStatus());
     }
 }