Skip to content

Commit

Permalink
Fix loading of TwigExtension for the cli, cron jobs and phpunit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Dec 18, 2019
1 parent 9256113 commit 3c44cdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@
'assets/'
));

// Add the Twig extension in case we don't have a request
if (PHP_SAPI === 'cli') {
// Add the Twig extension only we run the app from the command line / cron job,
// but not when phpunit tests are running.
if ((PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi') && !defined('PHPUNIT_TEST_SUITE')) {
$app = $container->get(App::class);
$routeParser = $app->getRouteCollector()->getRouteParser();
$uri = (new UriFactory())->createUri('http://localhost');
Expand Down

0 comments on commit 3c44cdb

Please sign in to comment.