Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #23 from cystbear/testSessionListenerPass

added TestSessionListenerPass
  • Loading branch information...
commit 543f88116c1346edbed1cd55daf015b544d98cd5 2 parents 58d04a9 + f88c8b0
Konstantin Kudryashov everzet authored
29 DependencyInjection/Compiler/TestSessionListenerPass.php
View
@@ -0,0 +1,29 @@
+<?php
+
+namespace Behat\MinkBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder,
+ Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/*
+ * This file is part of the Behat\MinkBundle
+ *
+ * (c) Konstantin Kudryashov <ever.zet@gmail.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * Behat\Mink container compilation pass. Replaces test session listener for real session listener.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+class TestSessionListenerPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ $sessionListenerClass = $container->getParameter('session_listener.class');
+ $container->setParameter('test.session.listener.class', $sessionListenerClass);
+ }
+}
6 MinkBundle.php
View
@@ -6,7 +6,8 @@
Symfony\Component\HttpKernel\Bundle\Bundle;
use Behat\MinkBundle\DependencyInjection\Compiler\SessionsPass,
- Behat\MinkBundle\DependencyInjection\Compiler\SelectorsHandlerPass;
+ Behat\MinkBundle\DependencyInjection\Compiler\SelectorsHandlerPass,
+ Behat\MinkBundle\DependencyInjection\Compiler\TestSessionListenerPass;
/*
* This file is part of the Behat\MinkBundle
@@ -35,5 +36,8 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new SessionsPass());
$container->addCompilerPass(new SelectorsHandlerPass());
+ if ('test' === $container->getParameterBag()->get('kernel.environment')) {
+ $container->addCompilerPass(new TestSessionListenerPass());
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.