Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Commit af7ecad

Browse files
patrickdreyerstof
authored andcommitted
Auto-detect and auto-activate installed wunit mink driver
1 parent e90955e commit af7ecad

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"require": {
1616
"php": ">=5.3.2",
17-
"behat/behat": ">=2.4.0,<2.4.x-dev"
17+
"behat/behat": ">=2.4.1,<2.4.x-dev"
1818
},
1919

2020
"autoload": {

src/Behat/YiiExtension/Extension.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public function load(array $config, ContainerBuilder $container)
3737
$loader->load('yii.xml');
3838
$basePath = $container->getParameter('behat.paths.base');
3939

40+
// starting from Behat 2.4.1, we can check for activated extensions
41+
$extensions = $container->hasParameter('behat.extension.classes')
42+
? $container->getParameter('behat.extension.classes')
43+
: array();
44+
4045
if (!isset($config['framework_script'])) {
4146
throw new \InvalidArgumentException(
4247
'Specify `framework_script` parameter for yii_extension.'
@@ -64,6 +69,8 @@ public function load(array $config, ContainerBuilder $container)
6469
);
6570
}
6671

72+
$loader->load('sessions/wunit.xml');
73+
} elseif (in_array('Behat\\MinkExtension\\Extension', $extensions) && class_exists('Behat\\Mink\\Driver\\WUnitDriver')) {
6774
$loader->load('sessions/wunit.xml');
6875
}
6976
}

0 commit comments

Comments
 (0)