Refactored the configuration of sessions

The configuration now makes sessions a first-class citizen instead of
being centered around drivers. This allows defining several session based
on the same driver type.
Instead of allowing other extensions to register their own sessions to add
new drivers, they can now register a DriverFactory in the MinkExtension
during the extension initialization to make a new driver type available.
This commit is contained in:
Christophe Coevoet
2014-01-11 00:04:23 +01:00
parent 589cd05897
commit 3ee16c4b87
18 changed files with 943 additions and 399 deletions

View File

@@ -0,0 +1,52 @@
<?php
/*
* This file is part of the Behat MinkExtension.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Behat\MinkExtension\ServiceContainer\Driver;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\Definition;
/**
* @author Christophe Coevoet <stof@notk.org>
*/
interface DriverFactory
{
/**
* Gets the name of the driver being configured.
*
* This will be the key of the configuration for the driver.
*
* @return string
*/
public function getDriverName();
/**
* Defines whether a session using this driver is eligible as default javascript session
*
* @return boolean
*/
public function supportsJavascript();
/**
* Setups configuration for the driver factory.
*
* @param ArrayNodeDefinition $builder
*/
public function configure(ArrayNodeDefinition $builder);
/**
* Builds the service definition for the driver.
*
* @param array $config
*
* @return Definition
*/
public function buildDriver(array $config);
}