Skip to content

Commit

Permalink
Merge pull request #6844 from GawainLynch/tests/more-coverage-is-more
Browse files Browse the repository at this point in the history
[3.3] Bootstrap tests & a couple of minor bug fixes
  • Loading branch information
GwendolenLynch committed Jul 21, 2017
2 parents f02c77a + 2f65b7b commit 06bcaa0
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ public static function run($rootPath)
foreach ((array) $config['services'] as $service) {
$params = [];
if (is_array($service)) {
$key = key($service);
$params = $service[$key];
$service = $key;
$params = reset($service);
$service = key($service);
}

if (is_string($service) && is_a($service, Silex\ServiceProviderInterface::class, true)) {
Expand All @@ -153,6 +152,13 @@ public static function run($rootPath)
}
}

if (!$config['extensions']) {
return $app;
}
if (!isset($app['extensions'])) {
throw new LogicException('Provided application object does not contain an extension service, but extensions are defined in bootstrap.');
}

$app['extensions'] = $app->share(
$app->extend(
'extensions',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/BoltListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private function buildTestEnv()
// Mirror in required assets.
$fs->mirror(TEST_ROOT . '/app/resources/', PHPUNIT_WEBROOT . '/app/resources/', null, ['override' => true]);
$fs->mirror(TEST_ROOT . '/app/theme_defaults/', PHPUNIT_WEBROOT . '/app/theme_defaults/', null, ['override' => true]);
$fs->mirror(TEST_ROOT . '/app/view/', PHPUNIT_WEBROOT . '/app/view/', null, ['override' => true]);
$fs->mirror(TEST_ROOT . '/app/view/twig', PHPUNIT_WEBROOT . '/app/view/twig', null, ['override' => true]);

// Make sure we wipe the db file to start with a clean one
$fs->copy($this->boltdb, PHPUNIT_WEBROOT . '/app/database/bolt.db', true);
Expand Down
Loading

0 comments on commit 06bcaa0

Please sign in to comment.