diff --git a/.travis.yml b/.travis.yml index fa286e4..e0453f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ cache: php: - 7.0 -install: composer update +install: COMPOSER_MEMORY_LIMIT=-1 composer update script: vendor/bin/phpunit -v diff --git a/EventListener/AlertifyListener.php b/EventListener/AlertifyListener.php index b24ecdd..a9f25f6 100644 --- a/EventListener/AlertifyListener.php +++ b/EventListener/AlertifyListener.php @@ -71,8 +71,9 @@ protected function injectAlertify(Response $response, Request $request) $hasMetaRefresh = false !== strripos($content, 'http-equiv="refresh"'); $forceInject = $response->headers->get('X-Inject-Alertify', false); $isRedirectResponse = $response instanceof RedirectResponse; + $hasPreviousSession = $request->hasPreviousSession(); - if ($hasBody && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) { + if ($hasBody && $hasPreviousSession && !$hasMetaRefresh && !$isRedirectResponse || $forceInject) { if ($response->getStatusCode() === 204) { throw new IncompatibleStatusCodeException(); } diff --git a/Tests/DependencyInjection/AlertifyExtensionTest.php b/Tests/DependencyInjection/AlertifyExtensionTest.php index 9704547..a23d66e 100644 --- a/Tests/DependencyInjection/AlertifyExtensionTest.php +++ b/Tests/DependencyInjection/AlertifyExtensionTest.php @@ -38,21 +38,21 @@ public function testContexts() $container = new ContainerBuilder(); $loader = new TroopersAlertifyExtension(); $loader->load([[ - 'contexts' => [ - 'front' => [ - 'engine' => 'notie', - 'options' => [ - 'animationDelay' => 300, - ], - ], - 'back' => [ - 'engine' => 'pushjs', - 'translationDomain' => 'admin', + 'contexts' => [ + 'front' => [ + 'engine' => 'notie', + 'options' => [ + 'animationDelay' => 300, ], ], - 'default' => [ - 'engine' => 'notie', - ], ]], $container); + 'back' => [ + 'engine' => 'pushjs', + 'translationDomain' => 'admin', + ], + ], + 'default' => [ + 'engine' => 'notie', + ], ]], $container); $this->assertSame([ 'contexts' => [ 'front' => [