Пример #1
0
 /**
  * Setups the environment to run unit tests. Includes the DI container and
  * optional creates an database schema
  *
  * @codeCoverageIgnore
  * @param string $basePath
  * @param Closure $schemaSetup
  */
 public static function setup($basePath, Closure $schemaSetup = null)
 {
     self::$basePath = $basePath;
     // setup PHP ini settings
     self::setupIni();
     // setup container
     self::setupContainer();
     // bootstrap PSX environment
     Bootstrap::setupEnvironment(self::getContainer()->get('config'));
     // setup database connection
     self::setupConnection(self::$container, $schemaSetup);
 }
Пример #2
0
 /**
  * Returns the di container
  *
  * @return PSX\DependencyInterface
  */
 protected static function getContainer($io)
 {
     if (self::$_container === null) {
         // create di container
         $container = new Dependency\Install();
         $container->setParameter('config.file', 'configuration.php');
         $container->setParameter('user.id', 1);
         // start bootstrap
         Bootstrap::setupEnvironment($container->get('config'));
         // set io
         $container->set('io', $io);
         // setup composer logger to redirect all log infos to the console
         $logger = new Logger('amun');
         $logger->pushHandler(new ComposerHandler($io, Logger::INFO));
         $container->set('logger', $logger);
         self::$_container = $container;
     }
     return self::$_container;
 }