Exemple #1
0
 public function testOne()
 {
     // Arrange & Assert
     $mock = $this->getMock('\\stdClass', array('callback'));
     $mock->expects($this->never())->method('callback');
     // Act
     $this->app['OneTest'] = $this->app->one('\\stdClass');
     $first = $this->app->get('OneTest');
     // Assert
     $this->assertInstanceOf('\\stdClass', $first);
     for ($i = 0; $i <= 5; $i++) {
         $result = $this->app->get('OneTest');
         $this->assertSame($first, $result);
     }
 }
 /**
  * Registers entries with the container.
  * @param Container $app
  */
 public function register(Container $app)
 {
     // old session
     $app[Session::class] = $app->make(Session::class);
     // old config
     $app[Config::class] = $app->one(Config::class);
     // old text system
     $app[Text::class] = $app->once(function (Config $config) use($app) {
         $args = [];
         if ($config->configExists('main', 'language_text')) {
             $args[] = $config->config('language_text');
         }
         return $app->make(Text::class, $args);
     });
     // Old database system
     $app[Database::class] = $app->one(Database::class);
     // Default style renderer
     $app[RendererInterface::class] = $app->one(Page::class);
     // Global Data
     $app[GlobalData::class] = new GlobalData($app);
 }