initial commit

This commit is contained in:
everzet
2012-05-06 21:13:51 +02:00
commit 7bfe9573e5
19 changed files with 1285 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace Behat\MinkExtension\Compiler;
use Symfony\Component\DependencyInjection\Reference,
Symfony\Component\DependencyInjection\ContainerBuilder,
Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/*
* This file is part of the Behat\MinkExtension
*
* (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.
* Registers all available in controller Mink sessions.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class SessionsPass implements CompilerPassInterface
{
/**
* Registers Mink sessions.
*
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('behat.mink')) {
return;
}
$minkDefinition = $container->getDefinition('behat.mink');
foreach ($container->findTaggedServiceIds('behat.mink.session') as $id => $attributes) {
foreach ($attributes as $attribute) {
if (isset($attribute['alias']) && $name = $attribute['alias']) {
$minkDefinition->addMethodCall(
'registerSession', array($name, new Reference($id))
);
}
}
}
$minkDefinition->addMethodCall(
'setDefaultSessionName', array($container->getParameter('behat.mink.default_session'))
);
}
}