Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added options to specify bundles, which will be tested with behat wit…

…hout arguments
  • Loading branch information...
commit 75e691273ef20e94755170d7e553485a50c6c402 1 parent 8f60479
@everzet everzet authored
View
11 Command/BehatCommand.php
@@ -89,12 +89,21 @@ protected function executeAllRegisteredBundles(InputInterface $input, OutputInte
{
$gherkin = $this->getContainer()->get('gherkin');
+ $testBundles = (array) $this->getContainer()->getParameter('behat.bundles');
+ $ignoreBundles = (array) $this->getContainer()->getParameter('behat.ignore_bundles');
+
$this->startSuite();
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
+ if (count($testBundles) && !in_array($bundle->getName(), $testBundles)) {
+ continue;
+ }
+ if (count($ignoreBundles) && in_array($bundle->getName(), $ignoreBundles)) {
+ continue;
+ }
+
$contextClass = $bundle->getNamespace().'\Features\Context\FeatureContext';
$featuresPath = $bundle->getPath().DIRECTORY_SEPARATOR.'Features';
-
if (!class_exists($contextClass)) {
continue;
}
View
10 DependencyInjection/BehatExtension.php
@@ -26,6 +26,16 @@ class BehatExtension extends BaseExtension
/**
* {@inheritdoc}
*/
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->configuration = new Configuration();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
protected function loadDefaults($container)
{
$behatClassLoaderReflection = new \ReflectionClass('Behat\Behat\Console\BehatApplication');
View
46 DependencyInjection/Configuration.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Behat\BehatBundle\DependencyInjection;
+
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+
+use Behat\Behat\DependencyInjection\Configuration as BaseConfiguration;

Shouldn't be

use Behat\Behat\DependencyInjection\Configuration\Configuration as BaseConfiguration;

?

https://github.com/Behat/Behat/blob/master/src/Behat/Behat/DependencyInjection/Configuration/Configuration.php

Oh my bad, sorry i used not the master version of behat :(

@stof Owner
stof added a note

@cedriclombardot BehatBundle is still for Behat 2.3 (which is still the latest stable release btw). For Behat 2.4, we will have a Symfony2Extension to let Behat know about Sf2 instead of letting Sf2 know about Behat (which causes many issues)

@stof Owner
stof added a note

and anyway, this commit was done 9 months ago, far before the changes of Behat 2.4 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+/*
+ * This file is part of the Behat\BehatBundle.
+ * (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.
+ */
+
+/**
+ * BehatBundle configuration.
+ *
+ * @author Konstantin Kudryashov <ever.zet@gmail.com>
+ */
+class Configuration extends BaseConfiguration
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function appendConfigChildrens(TreeBuilder $tree)
+ {
+ return parent::appendConfigChildrens($tree)->
+ fixXmlConfig('bundle')->
+ children()->
+ arrayNode('bundles')->
+ prototype('scalar')->
+ end()->
+ end()->
+ end()->
+ fixXmlConfig('ignore-bundle')->
+ children()->
+ arrayNode('ignore_bundles')->
+ defaultValue(array('BehatBundle'))->
+ prototype('scalar')->
+ end()->
+ end()->
+ end();
+ }
+}
View
2  Resources/config/behat_bundle.xml
@@ -4,6 +4,8 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="behat.context_dispatcher.class">Behat\BehatBundle\Context\ContextDispatcher</parameter>
+ <parameter key="behat.bundles" type="collection"></parameter>
+ <parameter key="behat.ignore_bundles" type="collection"></parameter>
</parameters>
<services>
<service id="behat.context_dispatcher" class="%behat.context_dispatcher.class%">
Please sign in to comment.
Something went wrong with that request. Please try again.