From b1f3a911ff4406540ad3212566e6d4bb10e0339f Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 25 Dec 2016 13:45:19 +0000
Subject: [PATCH 001/567] Bump dev version of Application
---
src/Behat/Behat/ApplicationFactory.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index 6309c7a52..5763f3d99 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -46,7 +46,7 @@
*/
final class ApplicationFactory extends BaseFactory
{
- const VERSION = '3.2-dev';
+ const VERSION = '3.3-dev';
/**
* {@inheritdoc}
From a998d45dca71340d5dd79b60fe1b6f7c70ff08fe Mon Sep 17 00:00:00 2001
From: Konstantin Kudryashov
Date: Sun, 25 Dec 2016 13:51:49 +0000
Subject: [PATCH 002/567] Update CHANGELOG.md
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19ae19f88..422264e18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* [#973](https://github.com/Behat/Behat/pull/974): Added helper containers
* [#973](https://github.com/Behat/Behat/pull/974): Added `SuiteScopedResolverFactory` extension point
+### Removed
+ * Removed php 5.3 from the Travis build matrix. You can consider it official end of support. 5.4 and 5.5 will follow shortly.
+
## [3.2.3] - 2016-12-25
### Fixed
* [#971](https://github.com/Behat/Behat/pull/971): Added support for suite names with hyphens
From e3b3423852c98fd85460b52220f14c13f17cd1a2 Mon Sep 17 00:00:00 2001
From: Martin Heigermoser
Date: Mon, 12 Dec 2016 11:11:33 +0100
Subject: [PATCH 003/567] add junit time attribute for scenarios and features
---
.../JUnit/JUnitDurationListener.php | 98 +++++++++++++++++++
.../Printer/JUnit/JUnitFeaturePrinter.php | 10 +-
.../Printer/JUnit/JUnitScenarioPrinter.php | 7 +-
.../Formatter/JUnitFormatterFactory.php | 8 ++
4 files changed, 120 insertions(+), 3 deletions(-)
create mode 100644 src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
new file mode 100644
index 000000000..f5cb3a59b
--- /dev/null
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
@@ -0,0 +1,98 @@
+captureBeforeScenarioEvent($event);
+ }
+
+ if ($event instanceof BeforeFeatureTested) {
+ $this->captureBeforeFeatureTested($event);
+ }
+
+ if ($event instanceof AfterScenarioTested) {
+ $this->captureAfterScenarioEvent($event);
+ }
+
+ if ($event instanceof AfterFeatureTested) {
+ $this->captureAfterFeatureEvent($event);
+ }
+ }
+
+ public function getDuration(ScenarioLikeInterface $scenario)
+ {
+ $key = $this->getHash($scenario);
+ return array_key_exists($key, $this->resultStore) ? $this->resultStore[$key] : '';
+ }
+
+ public function getFeatureDuration(FeatureNode $feature)
+ {
+ $key = $this->getHash($feature);
+ return array_key_exists($key, $this->featureResultStore) ? $this->featureResultStore[$key] : '';
+ }
+
+ private function captureBeforeFeatureTested(BeforeFeatureTested $event)
+ {
+ $this->featureTimerStore[$this->getHash($event->getFeature())] = $this->startTimer();
+ }
+
+ private function captureBeforeScenarioEvent(BeforeScenarioTested $event)
+ {
+ $this->scenarioTimerStore[$this->getHash($event->getScenario())] = $this->startTimer();
+ }
+
+ private function captureAfterScenarioEvent(AfterScenarioTested $event)
+ {
+ $key = $this->getHash($event->getScenario());
+ $timer = $this->scenarioTimerStore[$key];
+ if ($timer instanceof Timer) {
+ $timer->stop();
+ $this->resultStore[$key] = $timer->getSeconds();
+ }
+ }
+
+ private function captureAfterFeatureEvent(AfterFeatureTested $event)
+ {
+ $key = $this->getHash($event->getFeature());
+ $timer = $this->featureTimerStore[$key];
+ if ($timer instanceof Timer) {
+ $timer->stop();
+ $this->featureResultStore[$key] = $timer->getSeconds();
+ }
+ }
+
+ private function getHash(KeywordNodeInterface $node)
+ {
+ return spl_object_hash($node);
+ }
+
+ /** @return Timer */
+ private function startTimer()
+ {
+ $timer = new Timer();
+ $timer->start();
+
+ return $timer;
+ }
+}
diff --git a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
index 6b6e87184..7b3277a0d 100644
--- a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\Output\Node\Printer\JUnit;
+use Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener;
use Behat\Behat\Output\Node\Printer\FeaturePrinter;
use Behat\Behat\Output\Statistics\PhaseStatistics;
use Behat\Behat\Tester\Result\StepResult;
@@ -30,9 +31,15 @@ final class JUnitFeaturePrinter implements FeaturePrinter
*/
private $statistics;
- public function __construct(PhaseStatistics $statistics)
+ /**
+ * @var JUnitDurationListener
+ */
+ private $durationListener;
+
+ public function __construct(PhaseStatistics $statistics, JUnitDurationListener $durationListener)
{
$this->statistics = $statistics;
+ $this->durationListener = $durationListener;
}
/**
@@ -57,6 +64,7 @@ public function printHeader(Formatter $formatter, FeatureNode $feature)
'skipped' => $stats[TestResult::SKIPPED],
'failures' => $stats[TestResult::FAILED],
'errors' => $stats[TestResult::PENDING] + $stats[StepResult::UNDEFINED],
+ 'time' => $this->durationListener->getFeatureDuration($feature)
));
$this->statistics->reset();
}
diff --git a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
index cf61eaab9..27eb86de7 100644
--- a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
@@ -11,6 +11,7 @@
namespace Behat\Behat\Output\Node\Printer\JUnit;
use Behat\Behat\Output\Node\EventListener\JUnit\JUnitOutlineStoreListener;
+use Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener;
use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter;
use Behat\Gherkin\Node\ExampleNode;
use Behat\Gherkin\Node\FeatureNode;
@@ -47,10 +48,11 @@ final class JUnitScenarioPrinter
*/
private $outlineStepCount;
- public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener)
+ public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener, JUnitDurationListener $durationListener)
{
$this->resultConverter = $resultConverter;
$this->outlineStoreListener = $outlineListener;
+ $this->durationListener = $durationListener;
}
/**
@@ -71,7 +73,8 @@ public function printOpenTag(Formatter $formatter, FeatureNode $feature, Scenari
$outputPrinter->addTestcase(array(
'name' => $name,
- 'status' => $this->resultConverter->convertResultToString($result)
+ 'status' => $this->resultConverter->convertResultToString($result),
+ 'time' => $this->durationListener->getDuration($scenario)
));
}
diff --git a/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php b/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php
index a9d289516..4212fbb01 100644
--- a/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php
+++ b/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php
@@ -73,12 +73,14 @@ private function loadCorePrinters(ContainerBuilder $container)
$definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitFeaturePrinter', array(
new Reference('output.junit.statistics'),
+ new Reference('output.node.listener.junit.duration')
));
$container->setDefinition('output.node.printer.junit.feature', $definition);
$definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitScenarioPrinter', array(
new Reference(self::RESULT_TO_STRING_CONVERTER_ID),
new Reference('output.node.listener.junit.outline'),
+ new Reference('output.node.listener.junit.duration')
));
$container->setDefinition('output.node.printer.junit.scenario', $definition);
@@ -109,9 +111,15 @@ private function loadRootNodeListener(ContainerBuilder $container)
);
$container->setDefinition('output.node.listener.junit.outline', $definition);
+ $definition = new Definition(
+ 'Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener'
+ );
+
+ $container->setDefinition('output.node.listener.junit.duration', $definition);
$definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array(
array(
+ new Reference('output.node.listener.junit.duration'),
new Reference('output.node.listener.junit.outline'),
new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener', array(
new Reference('output.node.printer.junit.feature'),
From 72e178f1f1bb5d1cf8314c21cd89eaa6cb9fc4b1 Mon Sep 17 00:00:00 2001
From: Martin Heigermoser
Date: Thu, 5 Jan 2017 11:18:17 +0100
Subject: [PATCH 004/567] ignore time attribute in junit xml
---
features/bootstrap/FeatureContext.php | 4 ++
features/junit_format.feature | 58 +++++++++++++--------------
2 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index bc476cad3..0b9fdec15 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -9,7 +9,9 @@
*/
use Behat\Behat\Context\Context;
+use Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener;
use Behat\Gherkin\Node\PyStringNode;
+use Prophecy\Argument;
use Symfony\Component\Process\InputStream;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -240,6 +242,8 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
$fileContent = trim(file_get_contents($path));
+ $fileContent = preg_replace('/time="(.*)"/', 'time="-IGNORE-VALUE-"', $fileContent);
+
$dom = new DOMDocument();
$dom->loadXML($text);
$dom->formatOutput = true;
diff --git a/features/junit_format.feature b/features/junit_format.feature
index f9e4bfd88..a9cb00f11 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -104,25 +104,25 @@
"""
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
"""
@@ -191,11 +191,11 @@
"""
-
-
+
+
-
-
+
+
"""
@@ -266,9 +266,9 @@
"""
-
-
-
+
+
+
"""
@@ -386,8 +386,8 @@
"""
-
-
+
+
"""
@@ -396,8 +396,8 @@
"""
-
-
+
+
@@ -455,9 +455,9 @@
"""
-
-
-
+
+
+
"""
@@ -517,8 +517,8 @@
"""
-
-
+
+
@@ -655,8 +655,8 @@
"""
-
-
+
+
@@ -711,8 +711,8 @@
"""
-
-
+
+
From f1212fc6df0fbcc4d94458ab4130a7b7641fc1a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Fri, 27 Jan 2017 12:12:12 +0100
Subject: [PATCH 005/567] Prepare a pass for typehinted arguments
this is done in order that the next prepare call
(prepareNumberedArguments) have the right indexes for its arguments.
E.g, if for 5 arguments, we had the 2 typehinted `[1 => Foo, 3 => Bar]`,
before it would try to replace those with `[0 => 'foo', 1 => 'bar', 2 =>
'baz']`, resulting in `[0 => 'foo', 1 => Foo, 2 => 'baz', 3 => Bar]`
which is wrong, as we would expect it to be `[0 => 'foo', 1 => Foo, 2 =>
'bar', 3 => Bar, 4 => 'baz']`
To achieve that, we need to indicate that the typehinted args are
defined... Thus they are indeed skipped when trying to match numbered
args.
---
.../Argument/MixedArgumentOrganiser.php | 25 ++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 88ace2243..7a73ee86e 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -58,7 +58,7 @@ private function prepareArguments(array $parameters, array $arguments)
$arguments =
$this->prepareNamedArguments($parameters, $named) +
- $typehinted +
+ $this->prepareTypehintedArguments($typehinted) +
$this->prepareNumberedArguments($parameters, $numbered) +
$this->prepareDefaultArguments($parameters);
@@ -173,6 +173,29 @@ private function prepareNamedArguments(array $parameters, array $namedArguments)
return $arguments;
}
+ /**
+ * Captures argument value based on their respective typehints.
+ *
+ * Note ; as it is keeping in mind that $typeHintedArgument already has the
+ * right keys matching the correct parameter, it just iterates over this
+ * array in order to mark each arguments as "defined".
+ *
+ * @see https://github.com/Behat/Behat/pull/993#issuecomment-275669510
+ *
+ * @param mixed[] $typehintedArguments
+ *
+ * @return mixed[]
+ */
+ private function prepareTypehintedArguments(array $typehintedArguments)
+ {
+ foreach (array_keys($typehintedArguments) as $num) {
+ $this->markArgumentDefined($num);
+ }
+
+ return $typehintedArguments;
+ }
+
+
/**
* Captures argument values for undefined arguments based on their respective numbers.
*
From c4d727834b0010b4a6d2fa3bc74588338a8a9cad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Fri, 27 Jan 2017 12:18:32 +0100
Subject: [PATCH 006/567] Update CHANGELOG
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 422264e18..9ddd3b382 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
## [3.3.0] - 2016-12-25
### Added
From 0e832dab286d16b4b01b89ddfdaed87887bff92d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Sun, 29 Jan 2017 23:26:07 +0100
Subject: [PATCH 007/567] Add feature test for prepare arguments fix
---
features/helper_containers.feature | 41 ++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 9235aa744..f0bbdde62 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -305,3 +305,44 @@ Feature: Per-suite helper containers
"""
When I run "behat --no-colors -f progress features/container.feature"
Then it should pass
+
+ Scenario: Mix of typehinted arguments and numbered arguments (fix #991)
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - foo
+ - "@typehinted_service"
+ - bar
+
+ services:
+ typehinted_service:
+ class: stdClass
+ """
+ And a file named "features/container_args.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given foo
+ """
+ And a file named "features/bootstrap/FirstContext.php" with:
+ """
+
Date: Fri, 27 Jan 2017 10:21:22 +0100
Subject: [PATCH 008/567] Do not treat first argument as numbered argument if
typehinted
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 7a73ee86e..2b3251496 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -88,7 +88,7 @@ function (ReflectionParameter $parameter) {
foreach ($arguments as $key => $val) {
if ($this->isStringKeyAndExistsInParameters($key, $parameterNames)) {
$namedArguments[$key] = $val;
- } elseif ($num = $this->getParameterNumberWithTypehintingValue($parameters, $val)) {
+ } elseif (null !== ($num = $this->getParameterNumberWithTypehintingValue($parameters, $val))) {
$typehintedArguments[$num] = $val;
} else {
$numberedArguments[] = $val;
From a2a5fa8ddb0d21dff501ba32fccd3853f9ec981c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Fri, 27 Jan 2017 12:11:17 +0100
Subject: [PATCH 009/567] Update CHANGELOG
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ddd3b382..5cc6a1206 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
* [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
+ * [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
## [3.3.0] - 2016-12-25
### Added
From 41681cf92884e8ff61a57cfd66151054d94d7542 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Wed, 1 Feb 2017 13:32:02 +0100
Subject: [PATCH 010/567] Alter scenario for #993
---
features/helper_containers.feature | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index f0bbdde62..643b75609 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -314,7 +314,6 @@ Feature: Per-suite helper containers
default:
contexts:
- FirstContext:
- - foo
- "@typehinted_service"
- bar
@@ -333,10 +332,7 @@ Feature: Per-suite helper containers
Date: Wed, 15 Feb 2017 16:53:40 +0200
Subject: [PATCH 011/567] Allow to use `*.yaml` configuration files
This PR adds the ability to use `*.yaml` extension for the configuration, since this extension is considered official.
To keep backward compatibility but avoid extra file operation, checking with `is_file` was replaced with `glob`.
---
src/Behat/Behat/ApplicationFactory.php | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index 5763f3d99..a1ba8917a 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -110,16 +110,9 @@ protected function getEnvironmentVariableName()
*/
protected function getConfigPath()
{
- $cwd = rtrim(getcwd(), DIRECTORY_SEPARATOR);
- $paths = array_filter(
- array(
- $cwd . DIRECTORY_SEPARATOR . 'behat.yml',
- $cwd . DIRECTORY_SEPARATOR . 'behat.yml.dist',
- $cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml',
- $cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml.dist',
- ),
- 'is_file'
- );
+ $cwd = rtrim(getcwd(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
+ $configDir = 'config' . DIRECTORY_SEPARATOR;
+ $paths = glob("{$cwd}{,{$configDir}}behat.y{a,}ml{,.dist}", GLOB_BRACE);
if (count($paths)) {
return current($paths);
From c32bbdfc7bc79effe674ad2d842b38aa907ee827 Mon Sep 17 00:00:00 2001
From: Veaceslav Medvedev
Date: Wed, 15 Feb 2017 18:07:46 +0200
Subject: [PATCH 012/567] Revert usage of is_file instead of glob
---
src/Behat/Behat/ApplicationFactory.php | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index a1ba8917a..ced51d911 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -111,11 +111,22 @@ protected function getEnvironmentVariableName()
protected function getConfigPath()
{
$cwd = rtrim(getcwd(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
- $configDir = 'config' . DIRECTORY_SEPARATOR;
- $paths = glob("{$cwd}{,{$configDir}}behat.y{a,}ml{,.dist}", GLOB_BRACE);
-
- if (count($paths)) {
- return current($paths);
+ $configDir = $cwd . 'config' . DIRECTORY_SEPARATOR;
+ $paths = array(
+ $cwd . 'behat.yaml',
+ $cwd . 'behat.yml',
+ $cwd . 'behat.yaml.dist',
+ $cwd . 'behat.yml.dist',
+ $configDir . 'behat.yaml',
+ $configDir . 'behat.yml',
+ $configDir . 'behat.yaml.dist',
+ $configDir . 'behat.yml.dist',
+ );
+
+ foreach ($paths as $path) {
+ if (is_file($path)) {
+ return $path;
+ }
}
return null;
From 9e16d00f4ef5af40defac5ef42e5f3c2af9e2360 Mon Sep 17 00:00:00 2001
From: Veaceslav Medvedev
Date: Wed, 15 Feb 2017 19:11:26 +0200
Subject: [PATCH 013/567] Add scenarios to test config files order
---
features/bootstrap/FeatureContext.php | 60 ++++++++++++++++++++++++++-
features/config.feature | 33 +++++++++++++++
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index bc476cad3..8ee8bfacf 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -10,7 +10,6 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
-use Symfony\Component\Process\InputStream;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -88,6 +87,54 @@ public function aFileNamedWith($filename, PyStringNode $content)
$this->createFile($this->workingDir . '/' . $filename, $content);
}
+ /**
+ * Creates a empty file with specified name in current workdir.
+ *
+ * @Given /^(?:there is )?a file named "([^"]*)"$/
+ *
+ * @param string $filename name of the file (relative path)
+ */
+ public function aFileNamed($filename)
+ {
+ $this->createFile($this->workingDir . '/' . $filename, '');
+ }
+
+ /**
+ * Creates a noop feature context in current workdir.
+ *
+ * @Given /^(?:there is )?a some feature context$/
+ */
+ public function aNoopFeatureContext()
+ {
+ $filename = 'features/bootstrap/FeatureContext.php';
+ $content = <<<'EOL'
+createFile($this->workingDir . '/' . $filename, $content);
+ }
+
+ /**
+ * Creates a noop feature in current workdir.
+ *
+ * @Given /^(?:there is )?a some feature scenarios/
+ */
+ public function aNoopFeature()
+ {
+ $filename = 'features/bootstrap/FeatureContext.php';
+ $content = <<<'EOL'
+Feature:
+ Scenario:
+ When this scenario executes
+EOL;
+ $this->createFile($this->workingDir . '/' . $filename, $content);
+ }
+
/**
* Moves user to the specified path.
*
@@ -176,6 +223,17 @@ public function iRunBehatInteractively($answerString, $argumentsString)
$this->iRunBehat($argumentsString);
}
+ /**
+ * Runs behat command in debug mode
+ *
+ * @When /^I run behat in debug mode$/
+ */
+ public function iRunBehatInDebugMode()
+ {
+ $this->options = '';
+ $this->iRunBehat('--debug');
+ }
+
/**
* Checks whether previously ran command passes|fails with provided output.
*
diff --git a/features/config.feature b/features/config.feature
index d6b55b23a..53b84b09f 100644
--- a/features/config.feature
+++ b/features/config.feature
@@ -91,3 +91,36 @@ Feature: Config
"""
The requested config file does not exist
"""
+
+ Scenario: Prioritize *.yaml config file
+ Given a file named "behat.yaml"
+ Given a file named "behat.yml"
+ Given a some feature context
+ And a some feature scenarios
+ When I run behat in debug mode
+ Then the output should contain:
+ """
+ behat.yaml
+ """
+
+ Scenario: Load custom config instead of distribution
+ Given a file named "behat.yml"
+ Given a file named "behat.yaml.dist"
+ Given a some feature context
+ And a some feature scenarios
+ When I run behat in debug mode
+ Then the output should contain:
+ """
+ behat.yml
+ """
+
+ Scenario: Prioritize config file from root
+ Given a file named "behat.yaml.dist"
+ Given a file named "config/behat.yaml"
+ Given a some feature context
+ And a some feature scenarios
+ When I run behat in debug mode
+ Then the output should contain:
+ """
+ behat.yaml.dist
+ """
\ No newline at end of file
From 33c393c70088510a6b4285e200f1e9075cf91ce2 Mon Sep 17 00:00:00 2001
From: Kamil Kokot
Date: Thu, 16 Feb 2017 21:20:33 +0100
Subject: [PATCH 014/567] Correct command options descriptions
---
src/Behat/Testwork/Cli/Application.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Testwork/Cli/Application.php b/src/Behat/Testwork/Cli/Application.php
index 08eca8711..f9f35212e 100644
--- a/src/Behat/Testwork/Cli/Application.php
+++ b/src/Behat/Testwork/Cli/Application.php
@@ -75,8 +75,8 @@ public function getDefaultInputDefinition()
),
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
new InputOption('--config-reference', null, InputOption::VALUE_NONE, 'Display the configuration reference.'),
- new InputOption('--debug', null, InputOption::VALUE_NONE, 'Provide debuggin information about current environment.'),
- new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this behat version.'),
+ new InputOption('--debug', null, InputOption::VALUE_NONE, 'Provide debugging information about current environment.'),
+ new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display version.'),
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question.'),
new InputOption(
'--colors', null, InputOption::VALUE_NONE,
From fd4ec00790497a5711b89e2c6d29eca44722e264 Mon Sep 17 00:00:00 2001
From: Veaceslav Medvedev
Date: Fri, 17 Feb 2017 14:19:48 +0200
Subject: [PATCH 015/567] Update CHANGELOG
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cc6a1206..926fd7056 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Changed
+ * [#997](https://github.com/Behat/Behat/pull/997) Prioritize `*.yaml` extension for configuration files, as this extension is considered official.
+
### Fixed
* [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
* [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
From cf47261ea5a2e7376dafa307b3783b8768795fca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Tue, 4 Apr 2017 14:12:52 +0200
Subject: [PATCH 016/567] Use php 5.4 for the low dependency test instead of
php 5.3
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index b39461129..3d686d6bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,7 @@ branches:
matrix:
include:
- - php: 5.3
+ - php: 5.4
env: DEPENDENCIES='low'
- php: 5.6
env: SYMFONY_VERSION='2.3.*'
From 1aac3efe0eeea54928261c9367690387465d4b16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Tue, 4 Apr 2017 14:13:30 +0200
Subject: [PATCH 017/567] Remove job on sf 3.0 on 7.0
---
.travis.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 3d686d6bf..ca3cf9b9a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,8 +22,6 @@ matrix:
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- - php: 7.0
- env: SYMFONY_VERSION='3.0.*'
- php: 7.0
env: DEPENDENCIES='dev'
From 1edf9c6bb9b22299c6e4b8132f39fb8f20aeb6a0 Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 6 Apr 2017 19:38:23 +0100
Subject: [PATCH 018/567] Do not wait for HHVM build to finish
---
.travis.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index ca3cf9b9a..93165d8a1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,9 @@ matrix:
env: SYMFONY_VERSION='2.8.*'
- php: 7.0
env: DEPENDENCIES='dev'
+ allow_failures:
+ - php: hhvm
+ fast_finish: true
before_install:
- if [[ ${TRAVIS_PHP_VERSION:0:4} != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
From d878837228e10028612f1d61972e4c51bde533bf Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 6 Apr 2017 19:44:05 +0100
Subject: [PATCH 019/567] Bump PHP version used on AppVeyor to latest 7.1
---
appveyor.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index 4a8cd913f..7ef75979e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.0.9-nts-Win32-VC14-x86.zip
+ - PHP_DOWNLOAD_FILE: php-7.1.3-nts-Win32-VC14-x86.zip
branches:
only:
From 0cb14ea731f5a40d1c3aa02e3575bfca477772c3 Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 6 Apr 2017 19:46:23 +0100
Subject: [PATCH 020/567] Test Symfony=dev against 7.1
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 93165d8a1..943f02e18 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ matrix:
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- - php: 7.0
+ - php: 7.1
env: DEPENDENCIES='dev'
allow_failures:
- php: hhvm
From 72f555591fe684485723a7e0898e74382e366653 Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 6 Apr 2017 19:49:21 +0100
Subject: [PATCH 021/567] Fix Windows PHP download link
---
appveyor.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index 7ef75979e..c9a5eed06 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -28,7 +28,7 @@ init:
install:
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
- cd c:\php
- - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/%PHP_DOWNLOAD_FILE%
+ - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/%PHP_DOWNLOAD_FILE%
- IF %PHP%==1 7z x %PHP_DOWNLOAD_FILE% -y > 7z.log
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor DownloadFile https://getcomposer.org/composer.phar
From 9fbf95a7e51cdd54dd4cc6deee22bcc9e058ba60 Mon Sep 17 00:00:00 2001
From: Will Gibson
Date: Fri, 6 Jan 2017 17:40:57 +0000
Subject: [PATCH 022/567] Stop apostrophes causing unexpected capitals in
snippets for #976
---
CHANGELOG.md | 3 +++
composer.json | 2 +-
features/snippets.feature | 52 +++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 926fd7056..95f0dd7d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
* [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
* [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
+
+### Added
+ * [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that snippets treat words containing apostrophes as a single word
## [3.3.0] - 2016-12-25
### Added
diff --git a/composer.json b/composer.json
index 95eb16ba9..8a50e5686 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
"php": ">=5.3.3",
"ext-mbstring": "*",
"behat/gherkin": "^4.4.4",
- "behat/transliterator": "~1.0",
+ "behat/transliterator": "^1.2",
"symfony/console": "~2.5||~3.0",
"symfony/config": "~2.3||~3.0",
"symfony/dependency-injection": "~2.1||~3.0",
diff --git a/features/snippets.feature b/features/snippets.feature
index fcef28566..c3617d355 100644
--- a/features/snippets.feature
+++ b/features/snippets.feature
@@ -432,3 +432,55 @@ Feature: Snippets generation and addition
throw new PendingException();
}
"""
+
+ Scenario: Generating snippets for steps with apostrophes
+ Given a file named "features/bootstrap/FeatureContext.php" with:
+ """
+
Date: Thu, 4 May 2017 10:14:07 +0100
Subject: [PATCH 023/567] Fixes issue #1008 Adds in a new method to assign the
typehinted arguments to the best fitting constructor arguments.
---
.../Argument/MixedArgumentOrganiser.php | 91 ++++++++++++++-----
1 file changed, 70 insertions(+), 21 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 2b3251496..ac54270bf 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -58,7 +58,7 @@ private function prepareArguments(array $parameters, array $arguments)
$arguments =
$this->prepareNamedArguments($parameters, $named) +
- $this->prepareTypehintedArguments($typehinted) +
+ $this->prepareTypehintedArguments($parameters, $typehinted) +
$this->prepareNumberedArguments($parameters, $numbered) +
$this->prepareDefaultArguments($parameters);
@@ -88,8 +88,8 @@ function (ReflectionParameter $parameter) {
foreach ($arguments as $key => $val) {
if ($this->isStringKeyAndExistsInParameters($key, $parameterNames)) {
$namedArguments[$key] = $val;
- } elseif (null !== ($num = $this->getParameterNumberWithTypehintingValue($parameters, $val))) {
- $typehintedArguments[$num] = $val;
+ } elseif ($this->isParameterTypehintedInArgumentList($parameters, $val)) {
+ $typehintedArguments[] = $val;
} else {
$numberedArguments[] = $val;
}
@@ -112,26 +112,26 @@ private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
}
/**
- * Tries to find a parameter number, which typehints provided value.
+ * Check if a given value is typehinted in the argument list.
*
- * @param ReflectionParameter[] $parameters
- * @param mixed $value
+ * @param ReflectionParameter[] $parameters
+ * @param mixed $value
*
- * @return null|integer
+ * @return Boolean
*/
- private function getParameterNumberWithTypehintingValue(array $parameters, $value)
+ public function isParameterTypehintedInArgumentList(array $parameters, $value)
{
if (!is_object($value)) {
- return null;
+ return false;
}
- foreach ($parameters as $num => $parameter) {
+ foreach ($parameters as $parameter) {
if ($this->isValueMatchesTypehintedParameter($value, $parameter)) {
- return $num;
+ return true;
}
}
- return null;
+ return false;
}
/**
@@ -174,27 +174,76 @@ private function prepareNamedArguments(array $parameters, array $namedArguments)
}
/**
- * Captures argument value based on their respective typehints.
+ * Captures argument values for typehinted arguments based on the given candidates.
+ *
+ * This method attempts to match up the best fitting arguments to each constructor argument.
*
- * Note ; as it is keeping in mind that $typeHintedArgument already has the
- * right keys matching the correct parameter, it just iterates over this
- * array in order to mark each arguments as "defined".
+ * This case specifically fixes the issue where a constructor asks for a parent and child class,
+ * as separate arguments, but both arguments could satisfy the first argument,
+ * so they would both be passed in (overwriting each other).
*
- * @see https://github.com/Behat/Behat/pull/993#issuecomment-275669510
+ * This will ensure that the children (exact class matches) are mapped first, and then other dependencies
+ * are mapped sequentially (to arguments which they are an `instanceof`).
*
- * @param mixed[] $typehintedArguments
+ * As such, this requires two passes of the $parameters array to ensure it is mapped as accurately as possible.
+ *
+ * @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements)
+ * @param mixed[] $typehintedArguments Resolved arguments
*
* @return mixed[]
*/
- private function prepareTypehintedArguments(array $typehintedArguments)
+ private function prepareTypehintedArguments(array $parameters, array $typehintedArguments)
{
- foreach (array_keys($typehintedArguments) as $num) {
+ $arguments = [];
+
+ $candidates = $typehintedArguments;
+
+ foreach ($parameters as $num => $parameter) {
+ if ($this->isArgumentDefined($num)) {
+ continue;
+ }
+
+ foreach ($candidates as $candidateIndex => $candidate) {
+ $reflectionClass = $parameter->getClass();
+
+ if (!$reflectionClass || !$reflectionClass->isInstance($candidate)) {
+ continue;
+ }
+
+ if ($reflectionClass->getName() === get_class($candidate)) {
+ $arguments[$num] = $candidate;
+
$this->markArgumentDefined($num);
+
+ unset($candidates[$candidateIndex]);
+
+ break 1;
+ }
+ }
}
- return $typehintedArguments;
+ foreach ($parameters as $num => $parameter) {
+ if ($this->isArgumentDefined($num)) {
+ continue;
+ }
+
+ foreach ($candidates as $candidateIndex => $candidate) {
+ if (!$reflectionClass || !$reflectionClass->isInstance($candidate)) {
+ continue;
+ }
+
+ $arguments[$num] = $candidate;
+
+ $this->markArgumentDefined(true);
+
+ unset($candidates[$candidateIndex]);
+
+ break 1;
+ }
}
+ return $arguments;
+ }
/**
* Captures argument values for undefined arguments based on their respective numbers.
From 05c9e7468bf3e2ac13464d91f5e50bf9921e83a9 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Thu, 4 May 2017 10:24:10 +0100
Subject: [PATCH 024/567] Add a detailed descriptionn of the return value
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index ac54270bf..47c8ceb3d 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -190,7 +190,7 @@ private function prepareNamedArguments(array $parameters, array $namedArguments)
* @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements)
* @param mixed[] $typehintedArguments Resolved arguments
*
- * @return mixed[]
+ * @return mixed[] Ordered list of arguments, index is the constructor argument position, value is what will be injected
*/
private function prepareTypehintedArguments(array $parameters, array $typehintedArguments)
{
From 6d7c950c21af1165d7c20ca9f6487ccfb60cbf31 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Thu, 4 May 2017 10:26:49 +0100
Subject: [PATCH 025/567] Add missing parameter definition
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 47c8ceb3d..4fd072fe5 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -228,6 +228,8 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
}
foreach ($candidates as $candidateIndex => $candidate) {
+ $reflectionClass = $parameter->getClass();
+
if (!$reflectionClass || !$reflectionClass->isInstance($candidate)) {
continue;
}
From d47871ce03a7f57d85e7d6c4cdb89b46a25ddb2e Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Thu, 4 May 2017 11:00:47 +0100
Subject: [PATCH 026/567] Typo
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 4fd072fe5..1f306eb8a 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -236,7 +236,7 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
$arguments[$num] = $candidate;
- $this->markArgumentDefined(true);
+ $this->markArgumentDefined($num);
unset($candidates[$candidateIndex]);
From ea92d9542305f101b1719ff482a1444c173cdf59 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Thu, 4 May 2017 15:01:22 +0100
Subject: [PATCH 027/567] Add Behat test to check the status of the changes
I've added in
---
features/helper_containers.feature | 49 ++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 643b75609..cfc822816 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -342,3 +342,52 @@ Feature: Per-suite helper containers
"""
When I run "behat --no-colors -f progress features/container_args.feature"
Then it should pass
+
+ Scenario: Injecting typehinted arguments for a parent and child class (fix #1008)
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - "@child_class"
+ - "@parent_class"
+ services:
+ parent_class:
+ class: ParentClass
+ child_class:
+ class: ChildClass
+ """
+ And a file named "features/container_args.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given foo
+ """
+ And a file named "features/bootstrap/FirstContext.php" with:
+ """
+
Date: Mon, 8 May 2017 09:19:32 +0100
Subject: [PATCH 028/567] Update visibility to match other methods
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 1f306eb8a..48c7102d4 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -119,7 +119,7 @@ private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
*
* @return Boolean
*/
- public function isParameterTypehintedInArgumentList(array $parameters, $value)
+ private function isParameterTypehintedInArgumentList(array $parameters, $value)
{
if (!is_object($value)) {
return false;
From d7cc1409e17824d3041fab6cd89bb623f5d9caf8 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Mon, 8 May 2017 10:29:57 +0100
Subject: [PATCH 029/567] Refactor the code so that there is less repetition of
code (but in turn, more code...
---
.../Argument/MixedArgumentOrganiser.php | 59 ++++++++++++-------
1 file changed, 38 insertions(+), 21 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 48c7102d4..9bb4309ca 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -12,6 +12,7 @@
use Behat\Testwork\Argument\Exception\UnknownParameterValueException;
use ReflectionFunctionAbstract;
+use ReflectionClass;
use ReflectionMethod;
use ReflectionParameter;
@@ -198,30 +199,30 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
$candidates = $typehintedArguments;
- foreach ($parameters as $num => $parameter) {
- if ($this->isArgumentDefined($num)) {
- continue;
- }
-
- foreach ($candidates as $candidateIndex => $candidate) {
- $reflectionClass = $parameter->getClass();
+ $this->applyPredicateToTypehintedArguments($parameters, $candidates, $arguments, 'classMatchingPredicateForTypehintedArguments');
- if (!$reflectionClass || !$reflectionClass->isInstance($candidate)) {
- continue;
- }
-
- if ($reflectionClass->getName() === get_class($candidate)) {
- $arguments[$num] = $candidate;
-
- $this->markArgumentDefined($num);
+ // This iteration maps up everything else, providing the argument is an instanceof the parameter.
+ $this->applyPredicateToTypehintedArguments($parameters, $candidates, $arguments);
- unset($candidates[$candidateIndex]);
-
- break 1;
- }
- }
+ return $arguments;
}
+ /**
+ * Applies a predicate for each candidate when matching up typehinted arguments.
+ * This helps to avoid repetition when looping them, as multiple passes are needed over the parameters / candidates.
+ *
+ * @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements)
+ * @param mixed[] &$candidates Resolved arguments
+ * @param mixed[] &$arguments Argument mapping
+ * @param string $predicate [optional] Predicate to each candidate in this iteration
+ * @return void
+ */
+ private function applyPredicateToTypehintedArguments(
+ array $parameters,
+ array &$candidates,
+ array &$arguments,
+ $predicate = null
+ ) {
foreach ($parameters as $num => $parameter) {
if ($this->isArgumentDefined($num)) {
continue;
@@ -234,6 +235,12 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
continue;
}
+ if ($predicate !== null && method_exists($this, $predicate)) {
+ if (call_user_func_array([$this, $predicate], [$reflectionClass, $candidate]) !== true) {
+ continue;
+ }
+ }
+
$arguments[$num] = $candidate;
$this->markArgumentDefined($num);
@@ -243,8 +250,18 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
break 1;
}
}
+ }
- return $arguments;
+ /**
+ * Typehinted argument predicate to check if the argument and parameter classes match equally.
+ *
+ * @param ReflectionClass $reflectionClass Typehinted argument
+ * @param mixed $candidate Resolved argument
+ * @return boolean
+ */
+ private function classMatchingPredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate)
+ {
+ return $reflectionClass->getName() === get_class($candidate);
}
/**
From bb899c2a3761bca794ccd4a2db4736cf2a291922 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Mon, 8 May 2017 11:05:30 +0100
Subject: [PATCH 030/567] An attempt at removing complexity (from Scrutinizer)
by adding more code!
---
.../Argument/MixedArgumentOrganiser.php | 52 +++++++++++++------
1 file changed, 36 insertions(+), 16 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 9bb4309ca..c8c3bf26e 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -199,13 +199,23 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
$candidates = $typehintedArguments;
- $this->applyPredicateToTypehintedArguments($parameters, $candidates, $arguments, 'classMatchingPredicateForTypehintedArguments');
+ $this->applyPredicateToTypehintedArguments(
+ $parameters,
+ $candidates,
+ $arguments,
+ [$this, 'classMatchingPredicateForTypehintedArguments']
+ );
// This iteration maps up everything else, providing the argument is an instanceof the parameter.
- $this->applyPredicateToTypehintedArguments($parameters, $candidates, $arguments);
+ $this->applyPredicateToTypehintedArguments(
+ $parameters,
+ $candidates,
+ $arguments,
+ [$this, 'isInstancePredicateForTypehintedArguments']
+ );
return $arguments;
- }
+ }
/**
* Applies a predicate for each candidate when matching up typehinted arguments.
@@ -214,33 +224,31 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
* @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements)
* @param mixed[] &$candidates Resolved arguments
* @param mixed[] &$arguments Argument mapping
- * @param string $predicate [optional] Predicate to each candidate in this iteration
+ * @param callable $predicate Callable predicate to apply to each candidate
* @return void
*/
private function applyPredicateToTypehintedArguments(
array $parameters,
array &$candidates,
array &$arguments,
- $predicate = null
+ callable $predicate
) {
foreach ($parameters as $num => $parameter) {
if ($this->isArgumentDefined($num)) {
continue;
}
+
+ $reflectionClass = $parameter->getClass();
- foreach ($candidates as $candidateIndex => $candidate) {
- $reflectionClass = $parameter->getClass();
+ if (!$reflectionClass) {
+ continue;
+ }
- if (!$reflectionClass || !$reflectionClass->isInstance($candidate)) {
+ foreach ($candidates as $candidateIndex => $candidate) {
+ if (call_user_func_array($predicate, [$reflectionClass, $candidate]) !== true) {
continue;
}
- if ($predicate !== null && method_exists($this, $predicate)) {
- if (call_user_func_array([$this, $predicate], [$reflectionClass, $candidate]) !== true) {
- continue;
- }
- }
-
$arguments[$num] = $candidate;
$this->markArgumentDefined($num);
@@ -249,7 +257,7 @@ private function applyPredicateToTypehintedArguments(
break 1;
}
- }
+ }
}
/**
@@ -264,6 +272,18 @@ private function classMatchingPredicateForTypehintedArguments(ReflectionClass $r
return $reflectionClass->getName() === get_class($candidate);
}
+ /**
+ * Typehinted argument predicate to check if the argument is an instance of the parameter.
+ *
+ * @param ReflectionClass $reflectionClass Typehinted argument
+ * @param mixed $candidate Resolved argument
+ * @return boolean
+ */
+ private function isInstancePredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate)
+ {
+ return $reflectionClass->isInstance($candidate);
+ }
+
/**
* Captures argument values for undefined arguments based on their respective numbers.
*
@@ -421,4 +441,4 @@ private function isArgumentDefined($position)
{
return isset($this->definedArguments[$position]);
}
-}
+}
\ No newline at end of file
From e37c3bd9501a26ed2495725afbe689d1316bd115 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Mon, 8 May 2017 11:28:58 +0100
Subject: [PATCH 031/567] Further reduce the complexity by adding yet another
method
---
.../Argument/MixedArgumentOrganiser.php | 37 +++++++++++++++----
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index c8c3bf26e..5bee0da7f 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -217,6 +217,33 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
return $arguments;
}
+ /**
+ * Filtered out superfluous parameters for matching up typehinted arguments.
+ *
+ * @param ReflectionParameter[] $parameters Constructor Arguments
+ * @return ReflectionParameter[] Filtered $parameters
+ */
+ private function filterApplicableTypehintedParameters(array $parameters)
+ {
+ $filtered = [];
+
+ foreach ($parameters as $num => $parameter) {
+ if ($this->isArgumentDefined($num)) {
+ continue;
+ }
+
+ $reflectionClass = $parameter->getClass();
+
+ if (!$reflectionClass) {
+ continue;
+ }
+
+ $filtered[$num] = $parameter;
+ }
+
+ return $filtered;
+ }
+
/**
* Applies a predicate for each candidate when matching up typehinted arguments.
* This helps to avoid repetition when looping them, as multiple passes are needed over the parameters / candidates.
@@ -233,17 +260,11 @@ private function applyPredicateToTypehintedArguments(
array &$arguments,
callable $predicate
) {
+ $parameters = $this->filterApplicableTypehintedParameters($parameters);
+
foreach ($parameters as $num => $parameter) {
- if ($this->isArgumentDefined($num)) {
- continue;
- }
-
$reflectionClass = $parameter->getClass();
- if (!$reflectionClass) {
- continue;
- }
-
foreach ($candidates as $candidateIndex => $candidate) {
if (call_user_func_array($predicate, [$reflectionClass, $candidate]) !== true) {
continue;
From 19bedc8f9d23cd6bc700a65f82503bcc4521b4a1 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Mon, 8 May 2017 11:37:58 +0100
Subject: [PATCH 032/567] Rename variable for codestyle reasons
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 5bee0da7f..c05e9bd17 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -260,9 +260,9 @@ private function applyPredicateToTypehintedArguments(
array &$arguments,
callable $predicate
) {
- $parameters = $this->filterApplicableTypehintedParameters($parameters);
+ $filtered = $this->filterApplicableTypehintedParameters($parameters);
- foreach ($parameters as $num => $parameter) {
+ foreach ($filtered as $num => $parameter) {
$reflectionClass = $parameter->getClass();
foreach ($candidates as $candidateIndex => $candidate) {
From 2249f095e6a52cc7408fa112fe6b02e920207058 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Tue, 9 May 2017 10:11:55 +0100
Subject: [PATCH 033/567] Try and simplify a bit more...
---
.../Testwork/Argument/MixedArgumentOrganiser.php | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index c05e9bd17..ed8931908 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -263,20 +263,16 @@ private function applyPredicateToTypehintedArguments(
$filtered = $this->filterApplicableTypehintedParameters($parameters);
foreach ($filtered as $num => $parameter) {
- $reflectionClass = $parameter->getClass();
-
foreach ($candidates as $candidateIndex => $candidate) {
- if (call_user_func_array($predicate, [$reflectionClass, $candidate]) !== true) {
- continue;
- }
+ if (call_user_func_array($predicate, [$parameter->getClass(), $candidate])) {
+ $arguments[$num] = $candidate;
- $arguments[$num] = $candidate;
+ $this->markArgumentDefined($num);
- $this->markArgumentDefined($num);
-
- unset($candidates[$candidateIndex]);
+ unset($candidates[$candidateIndex]);
- break 1;
+ break 1;
+ }
}
}
}
From 567a8e4ebc7d4a1d2d2ddc09ea8349ed67767da2 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Tue, 9 May 2017 11:08:10 +0100
Subject: [PATCH 034/567] Add another method! To reduce complexity...
---
.../Argument/MixedArgumentOrganiser.php | 40 +++++++++++++++----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index ed8931908..a2f023cd9 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -246,7 +246,8 @@ private function filterApplicableTypehintedParameters(array $parameters)
/**
* Applies a predicate for each candidate when matching up typehinted arguments.
- * This helps to avoid repetition when looping them, as multiple passes are needed over the parameters / candidates.
+ * This passes through to another loop of the candidates in @matchParameterToCandidateUsingPredicate,
+ * because this method is "too complex" with two loops...
*
* @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements)
* @param mixed[] &$candidates Resolved arguments
@@ -263,18 +264,41 @@ private function applyPredicateToTypehintedArguments(
$filtered = $this->filterApplicableTypehintedParameters($parameters);
foreach ($filtered as $num => $parameter) {
- foreach ($candidates as $candidateIndex => $candidate) {
- if (call_user_func_array($predicate, [$parameter->getClass(), $candidate])) {
- $arguments[$num] = $candidate;
+ $this->matchParameterToCandidateUsingPredicate($parameter, $candidates, $arguments, $predicate);
+ }
+ }
+
+ /**
+ * Applies a predicate for each candidate when matching up typehinted arguments.
+ * This helps to avoid repetition when looping them, as multiple passes are needed over the parameters / candidates.
+ *
+ * @param ReflectionParameter $parameter Reflection Parameter (constructor argument requirements)
+ * @param mixed[] &$candidates Resolved arguments
+ * @param mixed[] &$arguments Argument mapping
+ * @param callable $predicate Callable predicate to apply to each candidate
+ * @return boolean Returns true if a candidate has been matched to the given parameter, otherwise false
+ */
+ public function matchParameterToCandidateUsingPredicate(
+ ReflectionParameter $parameter,
+ array &$candidates,
+ array &$arguments,
+ callable $predicate
+ ) {
+ foreach ($candidates as $candidateIndex => $candidate) {
+ if (call_user_func_array($predicate, [$parameter->getClass(), $candidate])) {
+ $num = $parameter->getPosition();
- $this->markArgumentDefined($num);
+ $arguments[$num] = $candidate;
- unset($candidates[$candidateIndex]);
+ $this->markArgumentDefined($num);
- break 1;
- }
+ unset($candidates[$candidateIndex]);
+
+ return true;
}
}
+
+ return false;
}
/**
From a02da149a4a4bcf2de279429e762b110b6b21cee Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 15 May 2017 17:15:04 +0100
Subject: [PATCH 035/567] Refactor to follow 5.3 style (for now)
This is not to support 5.3, but rather to have consistency across the
codebase.
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index a2f023cd9..0c919070e 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -195,7 +195,7 @@ private function prepareNamedArguments(array $parameters, array $namedArguments)
*/
private function prepareTypehintedArguments(array $parameters, array $typehintedArguments)
{
- $arguments = [];
+ $arguments = array();
$candidates = $typehintedArguments;
@@ -203,7 +203,7 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
$parameters,
$candidates,
$arguments,
- [$this, 'classMatchingPredicateForTypehintedArguments']
+ array($this, 'classMatchingPredicateForTypehintedArguments')
);
// This iteration maps up everything else, providing the argument is an instanceof the parameter.
@@ -211,7 +211,7 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
$parameters,
$candidates,
$arguments,
- [$this, 'isInstancePredicateForTypehintedArguments']
+ array($this, 'isInstancePredicateForTypehintedArguments')
);
return $arguments;
@@ -225,7 +225,7 @@ private function prepareTypehintedArguments(array $parameters, array $typehinted
*/
private function filterApplicableTypehintedParameters(array $parameters)
{
- $filtered = [];
+ $filtered = array();
foreach ($parameters as $num => $parameter) {
if ($this->isArgumentDefined($num)) {
@@ -482,4 +482,4 @@ private function isArgumentDefined($position)
{
return isset($this->definedArguments[$position]);
}
-}
\ No newline at end of file
+}
From 8a629b75365c0c0d3097b395266c07b3615e5056 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 15 May 2017 17:22:45 +0100
Subject: [PATCH 036/567] Add fix to the changelog
---
CHANGELOG.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 95f0dd7d9..10b4a6440 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
* [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
* [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
-
+ * [#1028](https://github.com/Behat/Behat/pull/1028) Parent / Child class argument ambiguity issue
+ with `MixedArgumentResolver`
+
### Added
* [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that snippets treat words containing apostrophes as a single word
From 0492ecb674301497012d8bf514aa95dc7798c45e Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 15 May 2017 17:27:57 +0100
Subject: [PATCH 037/567] Update changelog
---
CHANGELOG.md | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10b4a6440..85c063c7f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,17 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
-### Changed
- * [#997](https://github.com/Behat/Behat/pull/997) Prioritize `*.yaml` extension for configuration files, as this extension is considered official.
+
+## [3.3.1] - 2017-05-15
+### Added
+ * [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that snippets treat words containing apostrophes as a single word
### Fixed
* [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
* [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
- * [#1028](https://github.com/Behat/Behat/pull/1028) Parent / Child class argument ambiguity issue
- with `MixedArgumentResolver`
-
-### Added
- * [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that snippets treat words containing apostrophes as a single word
+ * [#1028](https://github.com/Behat/Behat/pull/1028) Parent / Child class argument ambiguity issue with `MixedArgumentResolver`
## [3.3.0] - 2016-12-25
### Added
@@ -807,7 +805,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.3.0...HEAD
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.3.1...HEAD
+[3.3.1]: https://github.com/Behat/Behat/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/Behat/Behat/compare/v3.2.3...v3.3.0
[3.2.3]: https://github.com/Behat/Behat/compare/v3.2.2...v3.2.3
[3.2.2]: https://github.com/Behat/Behat/compare/v3.2.1...v3.2.2
From b4466048e01725724757a189648e0da9f1ef6d13 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 15 May 2017 17:41:36 +0100
Subject: [PATCH 038/567] Add deployment step
---
.travis.yml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 943f02e18..dbad05c46 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -42,3 +42,22 @@ before_script:
script:
- phpunit
- behat -fprogress --strict --tags '~@php-version,'`php php_version_tags.php`
+
+before_deploy:
+ - curl -LSs https://box-project.github.io/box2/installer.php | php
+ - export PATH=.:$PATH
+ - rm -Rf ./vendor
+ - composer install --no-dev -o
+ - box.phar build
+
+deploy:
+ provider: releases
+ api_key:
+ secure: KLoJVMKTdabtNxRxVk92Lx9+ifK6nyYx2ATRflvaxJLJ0tkbvdkYwFnd79JuarE2FlJ65/Jd2Buy+dXCRPUkEaQ5Mg5IeZQg9C9qjTCjPE46n1nFa9487b/ZWsmx/iE7Bh8D2+A5CiEC62EXxWxf2i41IKaCr6t2ws49EjGOp+0=
+ file: behat.phar
+ skip_cleanup: true
+ on:
+ repo: Behat/Behat
+ tags: true
+ php: 5.6
+ condition: $SYMFONY_VERSION != "2.8.*"
From 44a58c1480d6144b2dc2c2bf02b9cef73c83840d Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 15 May 2017 17:49:16 +0100
Subject: [PATCH 039/567] Fix the conditional for deployment
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index dbad05c46..c33d5edad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -60,4 +60,4 @@ deploy:
repo: Behat/Behat
tags: true
php: 5.6
- condition: $SYMFONY_VERSION != "2.8.*"
+ condition: $SYMFONY_VERSION == "2.8.*"
From 3f5c2060d394de31b4842858f2b10b39c8fb335d Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Sat, 20 May 2017 11:07:50 +0100
Subject: [PATCH 040/567] Remove short array syntax
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 0c919070e..e50f47a7f 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -285,7 +285,7 @@ public function matchParameterToCandidateUsingPredicate(
callable $predicate
) {
foreach ($candidates as $candidateIndex => $candidate) {
- if (call_user_func_array($predicate, [$parameter->getClass(), $candidate])) {
+ if (call_user_func_array($predicate, array($parameter->getClass(), $candidate))) {
$num = $parameter->getPosition();
$arguments[$num] = $candidate;
From 36a9d2788ff1d11b1a25a9bf58f7f8f73a00de6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Droz?=
Date: Fri, 9 Jun 2017 11:47:55 -0300
Subject: [PATCH 041/567] support environment variable inside behat.yml
With symfony#21460 fixed (>= 3.3.0, symfony/symfony@a3fd5122), this change allow the use of environment variables in any section of behat configuration file.
For example: `base_url: "http://%env(HOSTNAME)%"`
---
src/Behat/Testwork/Cli/Application.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Cli/Application.php b/src/Behat/Testwork/Cli/Application.php
index f9f35212e..4189224e0 100644
--- a/src/Behat/Testwork/Cli/Application.php
+++ b/src/Behat/Testwork/Cli/Application.php
@@ -184,7 +184,7 @@ private function createContainer(InputInterface $input, OutputInterface $output)
$extension = new ContainerLoader($this->extensionManager);
$extension->load($container, $this->loadConfiguration($input));
$container->addObjectResource($extension);
- $container->compile();
+ $container->compile(true);
return $container;
}
From ec9e110e8d0fb738f5e201830ab9b7335a9873ff Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Fri, 21 Jul 2017 14:15:19 +0200
Subject: [PATCH 042/567] Fix a typo
---
.../Testwork/Argument/ServiceContainer/ArgumentExtension.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php b/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php
index 021966440..9aa5afeff 100644
--- a/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php
+++ b/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php
@@ -18,7 +18,7 @@
use Symfony\Component\DependencyInjection\Reference;
/**
- * Enables argument organises for the Testwork.
+ * Enables argument organisers for Testwork.
*
* @author Konstantin Kudryashov
*/
From c1b69b0bd6989d800797f52d90f2e7d697d686c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Henrique=20Faria?=
Date: Tue, 25 Apr 2017 23:04:27 -0300
Subject: [PATCH 043/567] add file info to definitions command
---
features/bootstrap/FeatureContext.php | 6 +++++-
features/syntax_help.feature | 4 ++++
.../Printer/ConsoleDefinitionInformationPrinter.php | 9 +++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 8ee8bfacf..ac49312f4 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -320,7 +320,11 @@ public function theOutputShouldContain(PyStringNode $text)
private function getExpectedOutput(PyStringNode $expectedText)
{
- $text = strtr($expectedText, array('\'\'\'' => '"""', '%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR));
+ $text = strtr($expectedText, array(
+ '\'\'\'' => '"""',
+ '%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR,
+ '%%WORKING_DIR%%' => $this->workingDir
+ ));
// windows path fix
if ('/' !== DIRECTORY_SEPARATOR) {
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index aa03422b8..fc166ad1f 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -247,6 +247,7 @@ Feature: Syntax helpers
"""
default | [Given|*] /^I have (\d+) apples?$/
| at `FeatureContext::iHaveApples()`
+ | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[11:13]`
default | [When|*] /^I ate (\d+) apples?$/
| Eating apples
@@ -255,12 +256,15 @@ Feature: Syntax helpers
| - one
| - two
| at `FeatureContext::iAteApples()`
+ | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[26:28]`
default | [When|*] /^I found (\d+) apples?$/
| at `FeatureContext::iFoundApples()`
+ | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[33:35]`
default | [Then|*] /^I should have (\d+) apples$/
| at `FeatureContext::iShouldHaveApples()`
+ | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[40:42]`
"""
Scenario: Search definition
diff --git a/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php
index 4c074ea45..9f504f815 100644
--- a/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php
+++ b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php
@@ -131,6 +131,15 @@ private function extractFooter(Suite $suite, Definition $definition)
)
);
+ $lines[] = strtr(
+ '{space}| on `{filepath}[{start}:{end}]`', array(
+ '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
+ '{filepath}' => $definition->getReflection()->getFileName(),
+ '{start}' => $definition->getReflection()->getStartLine(),
+ '{end}' => $definition->getReflection()->getEndLine()
+ )
+ );
+
return $lines;
}
}
From ee41bccaff76a52e224643675c142746c87783ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Henrique=20Faria?=
Date: Sat, 1 Jul 2017 11:30:24 -0300
Subject: [PATCH 044/567] print file name on definitions command only when
running on verbose mode
---
features/syntax_help.feature | 69 ++++++++++++++++++-
.../ConsoleDefinitionInformationPrinter.php | 18 ++---
.../Printer/ConsoleDefinitionPrinter.php | 10 +++
3 files changed, 88 insertions(+), 9 deletions(-)
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index fc166ad1f..fd548058d 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -214,7 +214,7 @@ Feature: Syntax helpers
/**
* Eating apples
- *
+ *
* More details on eating apples, and a list:
* - one
* - two
@@ -243,6 +243,73 @@ Feature: Syntax helpers
}
"""
When I run "behat --no-colors -di"
+ Then the output should contain:
+ """
+ default | [Given|*] /^I have (\d+) apples?$/
+ | at `FeatureContext::iHaveApples()`
+
+ default | [When|*] /^I ate (\d+) apples?$/
+ | Eating apples
+ | More details on eating apples, and a list:
+ | - one
+ | - two
+ | at `FeatureContext::iAteApples()`
+
+ default | [When|*] /^I found (\d+) apples?$/
+ | at `FeatureContext::iFoundApples()`
+
+ default | [Then|*] /^I should have (\d+) apples$/
+ | at `FeatureContext::iShouldHaveApples()`
+ """
+
+ Scenario: Print extended definitions info with file name and line numbers
+ Given a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ | on `{filepath}[{start}:{end}]`', array(
- '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
- '{filepath}' => $definition->getReflection()->getFileName(),
- '{start}' => $definition->getReflection()->getStartLine(),
- '{end}' => $definition->getReflection()->getEndLine()
- )
- );
+ if ($this->isVerbose()) {
+ $lines[] = strtr(
+ '{space}| on `{filepath}[{start}:{end}]`', array(
+ '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1),
+ '{filepath}' => $definition->getReflection()->getFileName(),
+ '{start}' => $definition->getReflection()->getStartLine(),
+ '{end}' => $definition->getReflection()->getEndLine()
+ )
+ );
+ }
return $lines;
}
diff --git a/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php
index 08b8f92ac..bd0546f41 100644
--- a/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php
+++ b/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php
@@ -110,4 +110,14 @@ final protected function translateDefinition(Suite $suite, Definition $definitio
{
return $this->translator->translateDefinition($suite, $definition);
}
+
+ /**
+ * Returns whether verbosity is verbose (-v).
+ *
+ * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
+ */
+ final protected function isVerbose()
+ {
+ return $this->output->isVerbose();
+ }
}
From 3fecfeba90c60fd65ddf2fcac34daa2fe6bbdff2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Henrique=20Faria?=
Date: Sat, 1 Jul 2017 12:47:25 -0300
Subject: [PATCH 045/567] fix broken test on windows environment
---
features/bootstrap/FeatureContext.php | 3 ++-
features/syntax_help.feature | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index ac49312f4..8b008deb7 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -323,7 +323,8 @@ private function getExpectedOutput(PyStringNode $expectedText)
$text = strtr($expectedText, array(
'\'\'\'' => '"""',
'%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR,
- '%%WORKING_DIR%%' => $this->workingDir
+ '%%WORKING_DIR%%' => $this->workingDir . DIRECTORY_SEPARATOR,
+ '%%DS%%' => DIRECTORY_SEPARATOR,
));
// windows path fix
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index fd548058d..1f6432ad6 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -314,7 +314,7 @@ Feature: Syntax helpers
"""
default | [Given|*] /^I have (\d+) apples?$/
| at `FeatureContext::iHaveApples()`
- | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[11:13]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[11:13]`
default | [When|*] /^I ate (\d+) apples?$/
| Eating apples
@@ -323,15 +323,15 @@ Feature: Syntax helpers
| - one
| - two
| at `FeatureContext::iAteApples()`
- | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[26:28]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[26:28]`
default | [When|*] /^I found (\d+) apples?$/
| at `FeatureContext::iFoundApples()`
- | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[33:35]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[33:35]`
default | [Then|*] /^I should have (\d+) apples$/
| at `FeatureContext::iShouldHaveApples()`
- | on `%%WORKING_DIR%%/features/bootstrap/FeatureContext.php[40:42]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[40:42]`
"""
Scenario: Search definition
From 90bf3160ea2c476a57d5b529eb31345e944cd819 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 12:46:44 +0100
Subject: [PATCH 046/567] Fix setting of WORKING_DIR in context
---
features/bootstrap/FeatureContext.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 8b008deb7..1e7f3fea4 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -323,7 +323,7 @@ private function getExpectedOutput(PyStringNode $expectedText)
$text = strtr($expectedText, array(
'\'\'\'' => '"""',
'%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR,
- '%%WORKING_DIR%%' => $this->workingDir . DIRECTORY_SEPARATOR,
+ '%%WORKING_DIR%%' => realpath($this->workingDir . DIRECTORY_SEPARATOR),
'%%DS%%' => DIRECTORY_SEPARATOR,
));
From 9612e9ebbb1ff3596d19ec62ce7c74a0cb0227ca Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 12:47:04 +0100
Subject: [PATCH 047/567] Update examples to reflect latest i18n
---
features/syntax_help.feature | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index 1f6432ad6..6b700da53 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -54,21 +54,21 @@ Feature: Syntax helpers
We need to be able to erase past agents' memory
[ПредыÑториÑ|КонтекÑÑ‚]:
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent A
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent A
[К тому же|Также|*|И] there is agent B
Сценарий: Erasing agent memory
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent J
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent J
[К тому же|Также|*|И] there is agent K
- [Когда|ЕÑли|*] I erase agent K's memory
- [Тогда|То|*] there should be agent J
+ [Когда|*] I erase agent K's memory
+ [Затем|Тогда|То|*] there should be agent J
[Ðо|*|Ð] there should not be agent K
Структура ÑценариÑ: Erasing other agents' memory
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent
[К тому же|Также|*|И] there is agent
- [Когда|ЕÑли|*] I erase agent 's memory
- [Тогда|То|*] there should be agent
+ [Когда|*] I erase agent 's memory
+ [Затем|Тогда|То|*] there should be agent
[Ðо|*|Ð] there should not be agent
Примеры:
@@ -192,7 +192,7 @@ Feature: Syntax helpers
default | ДопуÑтим /^у Ð¼ÐµÐ½Ñ (\d+) Ñблоко?$/
default | Когда /^I ate (\d+) apples?$/
default | Когда /^Я нашел (\d+) Ñблоко?$/
- default | Тогда /^I should have (\d+) apples$/
+ default | Затем /^I should have (\d+) apples$/
"""
Scenario: Print extended definitions info
@@ -314,7 +314,7 @@ Feature: Syntax helpers
"""
default | [Given|*] /^I have (\d+) apples?$/
| at `FeatureContext::iHaveApples()`
- | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[11:13]`
+ | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[11:13]`
default | [When|*] /^I ate (\d+) apples?$/
| Eating apples
@@ -323,15 +323,15 @@ Feature: Syntax helpers
| - one
| - two
| at `FeatureContext::iAteApples()`
- | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[26:28]`
+ | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[26:28]`
default | [When|*] /^I found (\d+) apples?$/
| at `FeatureContext::iFoundApples()`
- | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[33:35]`
+ | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[33:35]`
default | [Then|*] /^I should have (\d+) apples$/
| at `FeatureContext::iShouldHaveApples()`
- | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[40:42]`
+ | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[40:42]`
"""
Scenario: Search definition
@@ -399,6 +399,6 @@ Feature: Syntax helpers
When I run "behat --no-colors --lang=ru -d 'нашел'"
Then the output should contain:
"""
- default | [Когда|ЕÑли|*] /^Я нашел (\d+) Ñблоко?$/
+ default | [Когда|*] /^Я нашел (\d+) Ñблоко?$/
| at `FeatureContext::iFoundApples()`
"""
From 3b95012b81cb824d8379b1c324641f2bf3b74b44 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 12:47:40 +0100
Subject: [PATCH 048/567] Bump minimum Gherkin version required
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 8a50e5686..76897c8f6 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
"require": {
"php": ">=5.3.3",
"ext-mbstring": "*",
- "behat/gherkin": "^4.4.4",
+ "behat/gherkin": "^4.5.1",
"behat/transliterator": "^1.2",
"symfony/console": "~2.5||~3.0",
"symfony/config": "~2.3||~3.0",
From b834cbf20525ab1d1b074d5801f6813e86f88bb0 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 12:49:40 +0100
Subject: [PATCH 049/567] Bump PHP version used in Appveyor
---
appveyor.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index c9a5eed06..a1e451243 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.1.3-nts-Win32-VC14-x86.zip
+ - PHP_DOWNLOAD_FILE: php-7.1.8-nts-Win32-VC14-x86.zip
branches:
only:
From 1081d59073c0ed5c68f6aaf1df65af1c5496ab06 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 13:12:48 +0100
Subject: [PATCH 050/567] Fix tests on Windows
---
features/bootstrap/FeatureContext.php | 2 +-
features/syntax_help.feature | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 1e7f3fea4..629c6fc21 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -323,7 +323,7 @@ private function getExpectedOutput(PyStringNode $expectedText)
$text = strtr($expectedText, array(
'\'\'\'' => '"""',
'%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR,
- '%%WORKING_DIR%%' => realpath($this->workingDir . DIRECTORY_SEPARATOR),
+ '%%WORKING_DIR%%' => realpath($this->workingDir . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR,
'%%DS%%' => DIRECTORY_SEPARATOR,
));
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index 6b700da53..caf9d8006 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -314,7 +314,7 @@ Feature: Syntax helpers
"""
default | [Given|*] /^I have (\d+) apples?$/
| at `FeatureContext::iHaveApples()`
- | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[11:13]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[11:13]`
default | [When|*] /^I ate (\d+) apples?$/
| Eating apples
@@ -323,15 +323,15 @@ Feature: Syntax helpers
| - one
| - two
| at `FeatureContext::iAteApples()`
- | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[26:28]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[26:28]`
default | [When|*] /^I found (\d+) apples?$/
| at `FeatureContext::iFoundApples()`
- | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[33:35]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[33:35]`
default | [Then|*] /^I should have (\d+) apples$/
| at `FeatureContext::iShouldHaveApples()`
- | on `%%WORKING_DIR%%/features%%DS%%bootstrap%%DS%%FeatureContext.php[40:42]`
+ | on `%%WORKING_DIR%%features%%DS%%bootstrap%%DS%%FeatureContext.php[40:42]`
"""
Scenario: Search definition
From e44f9da22d8450907d647b1d2b09468acca14ac9 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 30 Jun 2017 08:01:12 +0100
Subject: [PATCH 051/567] Describe support for PSR-11
---
features/helper_containers.feature | 44 ++++++++++++++++++++++++++----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index cfc822816..934a6bbf9 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -7,7 +7,7 @@ Feature: Per-suite helper containers
- Having a container enables you to use its services as context arguments via `@name` syntax
- Container is rebuilt and is isolated between scenarios
- Container is configured via suite's `services` option
- - Container is a class implementing `Interop\Container\ContainerInterface`
+ - Container is a class implementing `Psr\Container\ContainerInterface`
- There is a built-in container if you need a very simple service-sharing, configurable through the same `services` setting
- There is an extension point that allows Behat extensions provide their own containers for end-users via `@name` syntax
@@ -120,7 +120,7 @@ Feature: Per-suite helper containers
"""
And a file named "features/bootstrap/MyContainer.php" with:
"""
- service) ? $this->service : $this->service = new SharedService();
+ }
+ }
+ """
+ When I run "behat --no-colors -f progress features/container.feature"
+ Then it should pass
+
Scenario: Simplest built-in container configuration
Given a file named "behat.yml" with:
"""
@@ -255,7 +289,7 @@ Feature: Per-suite helper containers
"""
And a file named "features/bootstrap/MyContainer.php" with:
"""
-
Date: Fri, 30 Jun 2017 08:01:39 +0100
Subject: [PATCH 052/567] Implement support for PSR-11
---
composer.json | 5 +++--
.../Behat/HelperContainer/Argument/ServicesResolver.php | 2 +-
.../HelperContainer/Argument/ServicesResolverFactory.php | 4 ++--
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php | 2 +-
.../HelperContainer/Exception/HelperContainerException.php | 4 ++--
.../HelperContainer/Exception/ServiceNotFoundException.php | 4 ++--
6 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/composer.json b/composer.json
index 76897c8f6..c21bc234c 100644
--- a/composer.json
+++ b/composer.json
@@ -25,13 +25,14 @@
"symfony/translation": "~2.3||~3.0",
"symfony/yaml": "~2.1||~3.0",
"symfony/class-loader": "~2.1||~3.0",
- "container-interop/container-interop": "^1.1"
+ "psr/container": "^1.0"
},
"require-dev": {
"symfony/process": "~2.5|~3.0",
"phpunit/phpunit": "~4.5",
- "herrera-io/box": "~1.6.1"
+ "herrera-io/box": "~1.6.1",
+ "container-interop/container-interop": "^1.2"
},
"suggest": {
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
index e8d23474d..1031a0587 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
@@ -11,7 +11,7 @@
namespace Behat\Behat\HelperContainer\Argument;
use Behat\Behat\Context\Argument\ArgumentResolver;
-use Interop\Container\ContainerInterface;
+use Psr\Container\ContainerInterface;
use ReflectionClass;
/**
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index e5dbfadc5..25617033f 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -16,7 +16,7 @@
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension;
use Behat\Testwork\Suite\Suite;
-use Interop\Container\ContainerInterface;
+use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
/**
@@ -157,7 +157,7 @@ private function createArgumentResolver($container)
if (!$container instanceof ContainerInterface) {
throw new WrongContainerClassException(
sprintf(
- 'Service container is expected to implement `Interop\Container\ContainerInterface`, but `%s` does not.',
+ 'Service container is expected to implement `Psr\Container\ContainerInterface`, but `%s` does not.',
get_class($container)
),
get_class($container)
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index 71795ee84..b3aead5e6 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -12,7 +12,7 @@
use Behat\Behat\HelperContainer\Exception\ServiceNotFoundException;
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
-use Interop\Container\ContainerInterface;
+use Psr\Container\ContainerInterface;
use ReflectionClass;
use ReflectionMethod;
diff --git a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
index 04ab35f96..317175af3 100644
--- a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
@@ -11,13 +11,13 @@
namespace Behat\Behat\HelperContainer\Exception;
use Behat\Testwork\Environment\Exception\EnvironmentException;
-use Interop\Container\Exception\ContainerException;
+use Psr\Container\ContainerExceptionInterface;
/**
* All HelperContainer exceptions implement this interface.
*
* @author Konstantin Kudryashov
*/
-interface HelperContainerException extends ContainerException, EnvironmentException
+interface HelperContainerException extends ContainerExceptionInterface, EnvironmentException
{
}
diff --git a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
index 02bd601b7..ba8d5bf15 100644
--- a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
@@ -10,7 +10,7 @@
namespace Behat\Behat\HelperContainer\Exception;
-use Interop\Container\Exception\NotFoundException;
+use Psr\Container\NotFoundExceptionInterface;
use InvalidArgumentException;
/**
@@ -18,7 +18,7 @@
*
* @author Konstantin Kudryashov
*/
-final class ServiceNotFoundException extends InvalidArgumentException implements HelperContainerException, NotFoundException
+final class ServiceNotFoundException extends InvalidArgumentException implements HelperContainerException, NotFoundExceptionInterface
{
/**
* @var string
From 12a5690104dc1232b80aad76e7bdd011dc837335 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 30 Jun 2017 08:06:25 +0100
Subject: [PATCH 053/567] Update CHANGES
---
CHANGELOG.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85c063c7f..775bfdbff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Added
+ * [#1054](https://github.com/Behat/Behat/pull/1054): PSR-11 support
+
+### Deprecated
+ * [#1054](https://github.com/Behat/Behat/pull/1054): `Interop\Container`
+ usage. Upgrade to `1.2` in the interim, but aim to move to `Psr\Container`
+ as soon as possible.
## [3.3.1] - 2017-05-15
### Added
From 09f941b3999f818c308e5d91b2a5a302ad5e2e34 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 30 Jun 2017 08:18:09 +0100
Subject: [PATCH 054/567] Update CHANGELOG
---
CHANGELOG.md | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 775bfdbff..535e9a9c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,12 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- * [#1054](https://github.com/Behat/Behat/pull/1054): PSR-11 support
+ * [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) support for helper containers.
### Deprecated
- * [#1054](https://github.com/Behat/Behat/pull/1054): `Interop\Container`
- usage. Upgrade to `1.2` in the interim, but aim to move to `Psr\Container`
- as soon as possible.
+ * [#1054](https://github.com/Behat/Behat/pull/1054): Deprecated usage
+ of `Interop\Container`. Versions prior to `1.2` are not supported, but `1.2`
+ is a non-breaking change. If you depend heavily on `Interop`, upgrade to
+ `1.2`, which is still supported by helper containers. Aim to migrate to
+ `Psr` before Behat 4.0 shows up on horizon
## [3.3.1] - 2017-05-15
### Added
From bbdcfb9b4a5adb38e20f212535d3a399ae2829a3 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 13:03:59 +0100
Subject: [PATCH 055/567] Specify conflict with container-interop prior v1.2
---
composer.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/composer.json b/composer.json
index c21bc234c..04aae8e83 100644
--- a/composer.json
+++ b/composer.json
@@ -28,6 +28,10 @@
"psr/container": "^1.0"
},
+ "conflict": {
+ "container-interop/container-interop": "<1.2"
+ },
+
"require-dev": {
"symfony/process": "~2.5|~3.0",
"phpunit/phpunit": "~4.5",
From ebae58a97c062a192dc415c5fe75b779f6eb93a2 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 13:37:03 +0100
Subject: [PATCH 056/567] Switch exceptions back to extend from Interop
container
---
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php | 2 +-
.../HelperContainer/Exception/HelperContainerException.php | 4 ++--
.../HelperContainer/Exception/ServiceNotFoundException.php | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index b3aead5e6..71795ee84 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -12,7 +12,7 @@
use Behat\Behat\HelperContainer\Exception\ServiceNotFoundException;
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
-use Psr\Container\ContainerInterface;
+use Interop\Container\ContainerInterface;
use ReflectionClass;
use ReflectionMethod;
diff --git a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
index 317175af3..04ab35f96 100644
--- a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
@@ -11,13 +11,13 @@
namespace Behat\Behat\HelperContainer\Exception;
use Behat\Testwork\Environment\Exception\EnvironmentException;
-use Psr\Container\ContainerExceptionInterface;
+use Interop\Container\Exception\ContainerException;
/**
* All HelperContainer exceptions implement this interface.
*
* @author Konstantin Kudryashov
*/
-interface HelperContainerException extends ContainerExceptionInterface, EnvironmentException
+interface HelperContainerException extends ContainerException, EnvironmentException
{
}
diff --git a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
index ba8d5bf15..02bd601b7 100644
--- a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
@@ -10,7 +10,7 @@
namespace Behat\Behat\HelperContainer\Exception;
-use Psr\Container\NotFoundExceptionInterface;
+use Interop\Container\Exception\NotFoundException;
use InvalidArgumentException;
/**
@@ -18,7 +18,7 @@
*
* @author Konstantin Kudryashov
*/
-final class ServiceNotFoundException extends InvalidArgumentException implements HelperContainerException, NotFoundExceptionInterface
+final class ServiceNotFoundException extends InvalidArgumentException implements HelperContainerException, NotFoundException
{
/**
* @var string
From c48c639f0ed0363bddaa5813bf48649e3903339b Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 13:41:58 +0100
Subject: [PATCH 057/567] Return back the interop-container dependency
---
composer.json | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/composer.json b/composer.json
index 04aae8e83..b3dbd81f3 100644
--- a/composer.json
+++ b/composer.json
@@ -25,18 +25,14 @@
"symfony/translation": "~2.3||~3.0",
"symfony/yaml": "~2.1||~3.0",
"symfony/class-loader": "~2.1||~3.0",
- "psr/container": "^1.0"
- },
-
- "conflict": {
- "container-interop/container-interop": "<1.2"
+ "psr/container": "^1.0",
+ "container-interop/container-interop": "^1.2"
},
"require-dev": {
"symfony/process": "~2.5|~3.0",
"phpunit/phpunit": "~4.5",
- "herrera-io/box": "~1.6.1",
- "container-interop/container-interop": "^1.2"
+ "herrera-io/box": "~1.6.1"
},
"suggest": {
From 08802b7f2d736b88df339e5411a1c722e92adbe3 Mon Sep 17 00:00:00 2001
From: Glenn McEwan
Date: Mon, 3 Jul 2017 14:11:12 +0100
Subject: [PATCH 058/567] Call setBasePath on the Gherkin manager when
registering the extension.
---
src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
index 2b33cd569..3f770aa72 100644
--- a/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
+++ b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
@@ -225,6 +225,7 @@ private function loadDefaultLoaders(ContainerBuilder $container, $cachePath)
}
$definition->addMethodCall('setCache', array($cacheDefinition));
+ $definition->addMethodCall('setBasePath', ['%paths.base%']);
$definition->addTag(self::LOADER_TAG, array('priority' => 50));
$container->setDefinition('gherkin.loader.gherkin_file', $definition);
}
From f3ed04666c7ef307a2ed9c12f9857e323d34b8a5 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 16:30:22 +0100
Subject: [PATCH 059/567] Add #1056 to changelog
---
CHANGELOG.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 535e9a9c4..311ac5b56 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- * [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) support for helper containers.
+ * [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md)
+ support for helper containers.
+
+### Fixed
+ * [#1056](https://github.com/Behat/Behat/pull/1056): Make Gherkin aware of the
+ base path so it can filter correctly
### Deprecated
* [#1054](https://github.com/Behat/Behat/pull/1054): Deprecated usage
From 1f4348a1cedbb91ce9d75b55ed61fdbdb8ae0e3f Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 16:31:50 +0100
Subject: [PATCH 060/567] Wrap long lines
---
CHANGELOG.md | 84 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 56 insertions(+), 28 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 311ac5b56..edb86da55 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,66 +22,92 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [3.3.1] - 2017-05-15
### Added
- * [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that snippets treat words containing apostrophes as a single word
+ * [#976](https://github.com/Behat/Behat/pull/1001): Add tests to check that
+ snippets treat words containing apostrophes as a single word
### Fixed
- * [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments organizer not marking typehinted arguments as "defined"
- * [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first argument as a numbered argument if it is in fact typehinted
- * [#1028](https://github.com/Behat/Behat/pull/1028) Parent / Child class argument ambiguity issue with `MixedArgumentResolver`
+ * [#993](https://github.com/Behat/Behat/pull/993) Fix mixed arguments
+ organizer not marking typehinted arguments as "defined"
+ * [#992](https://github.com/Behat/Behat/pull/993) Do not misinterpret first
+ argument as a numbered argument if it is in fact typehinted
+ * [#1028](https://github.com/Behat/Behat/pull/1028) Parent / Child class
+ argument ambiguity issue with `MixedArgumentResolver`
## [3.3.0] - 2016-12-25
### Added
* [#973](https://github.com/Behat/Behat/pull/974): Added helper containers
- * [#973](https://github.com/Behat/Behat/pull/974): Added `SuiteScopedResolverFactory` extension point
+ * [#973](https://github.com/Behat/Behat/pull/974): Added
+ `SuiteScopedResolverFactory` extension point
### Removed
- * Removed php 5.3 from the Travis build matrix. You can consider it official end of support. 5.4 and 5.5 will follow shortly.
+ * Removed php 5.3 from the Travis build matrix. You can consider it official
+ end of support. 5.4 and 5.5 will follow shortly.
## [3.2.3] - 2016-12-25
### Fixed
- * [#971](https://github.com/Behat/Behat/pull/971): Added support for suite names with hyphens
+ * [#971](https://github.com/Behat/Behat/pull/971): Added support for suite
+ names with hyphens
## [3.2.2] - 2016-11-05
### Fixed
- * [#959](https://github.com/Behat/Behat/issues/959): Fix transformations not sorted properly on different php version
+ * [#959](https://github.com/Behat/Behat/issues/959): Fix transformations not
+ sorted properly on different php version
## [3.2.1] - 2016-09-25
### Changed
- * [#955](https://github.com/Behat/Behat/pull/955): `--snippets-for` is not required now as interactive mode is the new default
- * [#954](https://github.com/Behat/Behat/pull/954): Stop execution on missing steps when running with `--stop-on-failure` and `--strict` options
+ * [#955](https://github.com/Behat/Behat/pull/955): `--snippets-for` is not
+ required now as interactive mode is the new default
+ * [#954](https://github.com/Behat/Behat/pull/954): Stop execution on missing
+ steps when running with `--stop-on-failure` and `--strict` options
## [3.2.0] - 2016-09-20
### Added
- * [#910](https://github.com/Behat/Behat/pull/910): Return type based transformations
- * [#903](https://github.com/Behat/Behat/pull/903): Multiline step definitions support
+ * [#910](https://github.com/Behat/Behat/pull/910): Return type based
+ transformations
+ * [#903](https://github.com/Behat/Behat/pull/903): Multiline step definitions
+ support
* [#930](https://github.com/Behat/Behat/pull/930): Whole table transformation
* [#935](https://github.com/Behat/Behat/pull/935): Narrative filters in suites
* [#936](https://github.com/Behat/Behat/pull/936): Debug command
- * [#931](https://github.com/Behat/Behat/pull/931): Exception handlers extension point
- * [#870](https://github.com/Behat/Behat/pull/870): Added build-related files and folders to .gitattributes
- * [#946](https://github.com/Behat/Behat/pull/946): Official full Windows support with CI ([AppVeyor](http://appveyor.com)) on every build
+ * [#931](https://github.com/Behat/Behat/pull/931): Exception handlers
+ extension point
+ * [#870](https://github.com/Behat/Behat/pull/870): Added build-related files
+ and folders to .gitattributes
+ * [#946](https://github.com/Behat/Behat/pull/946): Official full Windows
+ support with CI ([AppVeyor](http://appveyor.com)) on every build
### Changed
* [#922](https://github.com/Behat/Behat/pull/922): Snippets generation revamp
- * [#920](https://github.com/Behat/Behat/pull/920): More context for pending/failed steps with progress formatter
+ * [#920](https://github.com/Behat/Behat/pull/920): More context for
+ pending/failed steps with progress formatter
* [#905](https://github.com/Behat/Behat/pull/905): Transformations refactoring
- * [#864](https://github.com/Behat/Behat/pull/864): Use only one autoloader if possible
- * [#920](https://github.com/Behat/Behat/pull/920): Improve "No specifications found" error message
+ * [#864](https://github.com/Behat/Behat/pull/864): Use only one autoloader if
+ possible
+ * [#920](https://github.com/Behat/Behat/pull/920): Improve "No specifications
+ found" error message
* Refactor changelog to follow [Keep a Changelog](http://keepachangelog.com/)
* Refreshed [CONTRIBUTING.md](CONTRIBUTING.md)
* Refreshed Scrutinizer config
### Fixed
- * [#911](https://github.com/Behat/Behat/pull/911): Fix context isolation for Scenario Outlines
- * [#860](https://github.com/Behat/Behat/pull/860): Include basepath in `generateKey`
- * [#857](https://github.com/Behat/Behat/pull/857): Only cache failed scenario's for rerun
- * [#933](https://github.com/Behat/Behat/pull/933): Save failed runs with suite information
- * [#833](https://github.com/Behat/Behat/pull/833): Properly handle interupts on PHP7
- * [#904](https://github.com/Behat/Behat/pull/904): Provide clearer exception message when long token names used
- * [#941](https://github.com/Behat/Behat/pull/941): Transformation should be allowed if printable chars are used
+ * [#911](https://github.com/Behat/Behat/pull/911): Fix context isolation for
+ Scenario Outlines
+ * [#860](https://github.com/Behat/Behat/pull/860): Include basepath in
+ `generateKey`
+ * [#857](https://github.com/Behat/Behat/pull/857): Only cache failed
+ scenario's for rerun
+ * [#933](https://github.com/Behat/Behat/pull/933): Save failed runs with suite
+ information
+ * [#833](https://github.com/Behat/Behat/pull/833): Properly handle interupts
+ on PHP7
+ * [#904](https://github.com/Behat/Behat/pull/904): Provide clearer exception
+ message when long token names used
+ * [#941](https://github.com/Behat/Behat/pull/941): Transformation should be
+ allowed if printable chars are used
### Deprecated
- * [#922](https://github.com/Behat/Behat/pull/922): `*SnippetAcceptingContext` interfaces
+ * [#922](https://github.com/Behat/Behat/pull/922): `*SnippetAcceptingContext`
+ interfaces
* [#905](https://github.com/Behat/Behat/pull/905): `RuntimeTransformation`
* [#905](https://github.com/Behat/Behat/pull/905): `Transformation::getPattern`
* [#920](https://github.com/Behat/Behat/pull/920): `StepStat`
@@ -100,7 +126,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Add Japanese translation (thanks @SNakano)
* Add romanian translation for formatters (thanks @Chriton)
* Add table row transformations (thanks @ciaranmcnulty)
- * Add support for negative numbers without surrounding quotes (thanks @ryancookdev)
+ * Add support for negative numbers without surrounding quotes (thanks
+ @ryancookdev)
* Handle case when non-existent config file is used (thanks @watermanio)
* Handle non-default `error_reporting()`
* Handle PHP7 errors implementing `Throwable`
@@ -114,7 +141,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Allow suite settings with null values to exist (thanks @docteurklein)
* Improve "can not generate snippets" message
* Improve performance of Turnip parsing (thanks @Sam-Burns)
- * Improve the snippet generation by auto-importing needed classes (thanks @stof)
+ * Improve the snippet generation by auto-importing needed classes (thanks
+ @stof)
## [3.0.15] - 2015-02-22
### Changed
From bf5ebd4e044588e8335e150e5133ae2e0b5e5dad Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 16:49:10 +0100
Subject: [PATCH 061/567] Add support for modern phpunit
---
CHANGELOG.md | 1 +
.../Exception/Stringer/PHPUnitExceptionStringer.php | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index edb86da55..18ff849a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
* [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md)
support for helper containers.
+ * Support for modern PHPUnit.
### Fixed
* [#1056](https://github.com/Behat/Behat/pull/1056): Make Gherkin aware of the
diff --git a/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php b/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php
index 3534924f8..0b06299ef 100644
--- a/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php
+++ b/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php
@@ -11,8 +11,6 @@
namespace Behat\Testwork\Exception\Stringer;
use Exception;
-use PHPUnit_Framework_Exception;
-use PHPUnit_Framework_TestFailure;
/**
* Strings PHPUnit assertion exceptions.
@@ -28,7 +26,8 @@ final class PHPUnitExceptionStringer implements ExceptionStringer
*/
public function supportsException(Exception $exception)
{
- return $exception instanceof PHPUnit_Framework_Exception;
+ return $exception instanceof \PHPUnit_Framework_Exception
+ || $exception instanceof \PHPUnit\Framework\Exception;
}
/**
@@ -36,9 +35,13 @@ public function supportsException(Exception $exception)
*/
public function stringException(Exception $exception, $verbosity)
{
+ if (!class_exists('PHPUnit\\Framework\\TestFailure')) {
+ return trim(\PHPUnit_Framework_TestFailure::exceptionToString($exception));
+ }
+
// PHPUnit assertion exceptions do not include expected / observed info in their
// messages, but expect the test listeners to format that info like the following
// (see e.g. PHPUnit_TextUI_ResultPrinter::printDefectTrace)
- return trim(PHPUnit_Framework_TestFailure::exceptionToString($exception));
+ return trim(\PHPUnit\Framework\TestFailure::exceptionToString($exception));
}
}
From 905dddc5e7d1bf489c82c473e0b3953b1d4d35e7 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 16:55:33 +0100
Subject: [PATCH 062/567] Upgrade internal test suite to modern phpunit
---
composer.json | 2 +-
features/append_snippets.feature | 48 +++++++--------
features/arguments.feature | 8 +--
features/bootstrap/FeatureContext.php | 31 +++++-----
features/config_inheritance.feature | 4 +-
features/context.feature | 8 +--
features/definitions_patterns.feature | 58 +++++++++----------
features/definitions_transformations.feature | 12 ++--
features/definitions_translations.feature | 16 ++---
features/error_reporting.feature | 4 +-
features/extensions.feature | 2 +-
features/format_options.feature | 8 +--
features/helper_containers.feature | 4 +-
features/hooks.feature | 2 +-
features/i18n.feature | 2 +-
features/junit_format.feature | 16 ++---
features/multiple_formats.feature | 8 +--
features/outlines.feature | 4 +-
features/parameters.feature | 2 +-
features/pretty_format.feature | 6 +-
features/profiles.feature | 2 +-
features/rerun.feature | 8 +--
features/rerun_with_multiple_suite.feature | 8 +--
features/result_types.feature | 4 +-
features/traits.feature | 2 +-
.../Subject/GroupedSubjectIteratorTest.php | 3 +-
26 files changed, 137 insertions(+), 135 deletions(-)
diff --git a/composer.json b/composer.json
index b3dbd81f3..a056e594b 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"require-dev": {
"symfony/process": "~2.5|~3.0",
- "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit": "~6.3",
"herrera-io/box": "~1.6.1"
},
diff --git a/features/append_snippets.feature b/features/append_snippets.feature
index 8eb9390ec..e1727bdb4 100644
--- a/features/append_snippets.feature
+++ b/features/append_snippets.feature
@@ -47,22 +47,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -162,22 +162,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -267,22 +267,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -332,22 +332,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -435,22 +435,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -500,22 +500,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
diff --git a/features/arguments.feature b/features/arguments.feature
index 6da60915a..161a18111 100644
--- a/features/arguments.feature
+++ b/features/arguments.feature
@@ -44,22 +44,22 @@ Feature: Step Arguments
* @Then /^it must be equals to string (\d+)$/
*/
public function itMustBeEqualsToString($number) {
- \PHPUnit_Framework_Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
+ \PHPUnit\Framework\Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
}
/**
* @Then /^it must be equals to table (\d+)$/
*/
public function itMustBeEqualsToTable($number) {
- \PHPUnit_Framework_Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
+ \PHPUnit\Framework\Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
}
/**
* @Given /^I have number2 = (?P\d+) and number1 = (?P\d+)$/
*/
public function iHaveNumberAndNumber($number1, $number2) {
- \PHPUnit_Framework_Assert::assertEquals(13, intval($number1));
- \PHPUnit_Framework_Assert::assertEquals(243, intval($number2));
+ \PHPUnit\Framework\Assert::assertEquals(13, intval($number1));
+ \PHPUnit\Framework\Assert::assertEquals(243, intval($number2));
}
}
"""
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 629c6fc21..11905b956 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -10,6 +10,7 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
+use PHPUnit\Framework\Assert;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -119,12 +120,12 @@ class FeatureContext implements Context
$this->createFile($this->workingDir . '/' . $filename, $content);
}
- /**
- * Creates a noop feature in current workdir.
- *
- * @Given /^(?:there is )?a some feature scenarios/
- */
- public function aNoopFeature()
+ /**
+ * Creates a noop feature in current workdir.
+ *
+ * @Given /^(?:there is )?a some feature scenarios/
+ */
+ public function aNoopFeature()
{
$filename = 'features/bootstrap/FeatureContext.php';
$content = <<<'EOL'
@@ -156,7 +157,7 @@ public function iAmInThePath($path)
*/
public function fileShouldExist($path)
{
- PHPUnit_Framework_Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
+ Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
}
/**
@@ -258,7 +259,7 @@ public function itShouldPassWith($success, PyStringNode $text)
public function itShouldPassWithNoOutput($success)
{
$this->itShouldFail($success);
- PHPUnit_Framework_Assert::assertEmpty($this->getOutput());
+ Assert::assertEmpty($this->getOutput());
}
/**
@@ -272,7 +273,7 @@ public function itShouldPassWithNoOutput($success)
public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- PHPUnit_Framework_Assert::assertFileExists($path);
+ Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
@@ -280,7 +281,7 @@ public function fileShouldContain($path, PyStringNode $text)
$fileContent = str_replace(PHP_EOL, "\n", $fileContent);
}
- PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
+ Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
}
/**
@@ -294,7 +295,7 @@ public function fileShouldContain($path, PyStringNode $text)
public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- PHPUnit_Framework_Assert::assertFileExists($path);
+ Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
@@ -302,7 +303,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
$dom->loadXML($text);
$dom->formatOutput = true;
- PHPUnit_Framework_Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
+ Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
}
@@ -315,7 +316,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
*/
public function theOutputShouldContain(PyStringNode $text)
{
- PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
+ Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
}
private function getExpectedOutput(PyStringNode $expectedText)
@@ -363,13 +364,13 @@ public function itShouldFail($success)
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
+ Assert::assertNotEquals(0, $this->getExitCode());
} else {
if (0 !== $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
+ Assert::assertEquals(0, $this->getExitCode());
}
}
diff --git a/features/config_inheritance.feature b/features/config_inheritance.feature
index c418ad404..16d6cb5e6 100644
--- a/features/config_inheritance.feature
+++ b/features/config_inheritance.feature
@@ -73,12 +73,12 @@ Feature: Config inheritance
/** @Then the context parameters should be overwritten */
public function theContextParametersOverwrite() {
- \PHPUnit_Framework_Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
+ \PHPUnit\Framework\Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
}
/** @Then the extension config should be merged */
public function theExtensionConfigMerge() {
- \PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
+ \PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
}
}
"""
diff --git a/features/context.feature b/features/context.feature
index e96118009..eae21a44a 100644
--- a/features/context.feature
+++ b/features/context.feature
@@ -47,22 +47,22 @@ Feature: Context consistency
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
diff --git a/features/definitions_patterns.feature b/features/definitions_patterns.feature
index 66d4d553f..66eeb73d2 100644
--- a/features/definitions_patterns.feature
+++ b/features/definitions_patterns.feature
@@ -158,8 +158,8 @@ Feature: Step Definition Pattern
* @Given only second :second
*/
public function invalidRegex($first = 'foo', $second = 'fiz') {
- PHPUnit_Framework_Assert::assertEquals('foo', $first);
- PHPUnit_Framework_Assert::assertEquals('bar', $second);
+ PHPUnit\Framework\Assert::assertEquals('foo', $first);
+ PHPUnit\Framework\Assert::assertEquals('bar', $second);
}
}
"""
@@ -192,7 +192,7 @@ Feature: Step Definition Pattern
* @Given I can provide parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit_Framework_Assert::assertNull($param);
+ PHPUnit\Framework\Assert::assertNull($param);
}
}
"""
@@ -256,7 +256,7 @@ Feature: Step Definition Pattern
* parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit_Framework_Assert::assertNull($param);
+ PHPUnit\Framework\Assert::assertNull($param);
}
}
"""
@@ -295,8 +295,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $param2) {
- PHPUnit_Framework_Assert::assertEquals('one', $param1);
- PHPUnit_Framework_Assert::assertEquals('two', $param2);
+ PHPUnit\Framework\Assert::assertEquals('one', $param1);
+ PHPUnit\Framework\Assert::assertEquals('two', $param2);
}
}
"""
@@ -328,8 +328,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $someParam) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $someParam);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $someParam);
}
}
"""
@@ -361,9 +361,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
- PHPUnit_Framework_Assert::assertEquals(2, $count);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
+ PHPUnit\Framework\Assert::assertEquals(2, $count);
}
}
"""
@@ -395,10 +395,10 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam with:
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count, $string) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
- PHPUnit_Framework_Assert::assertEquals(2, $count);
- PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
+ PHPUnit\Framework\Assert::assertEquals(2, $count);
+ PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -433,9 +433,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters for :name:
*/
public function multipleWrongNamedParameters($count, $name, $string) {
- PHPUnit_Framework_Assert::assertEquals('2', $count);
- PHPUnit_Framework_Assert::assertEquals('thing', $name);
- PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
+ PHPUnit\Framework\Assert::assertEquals('2', $count);
+ PHPUnit\Framework\Assert::assertEquals('thing', $name);
+ PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -472,9 +472,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality($path = null, $isNegative = null, PyStringNode $json = null)
{
- PHPUnit_Framework_Assert::assertNull($path);
- PHPUnit_Framework_Assert::assertNull($isNegative);
- PHPUnit_Framework_Assert::assertNotNull($json);
+ PHPUnit\Framework\Assert::assertNull($path);
+ PHPUnit\Framework\Assert::assertNull($isNegative);
+ PHPUnit\Framework\Assert::assertNotNull($json);
}
/**
@@ -482,9 +482,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality2($json = null, $path = null, $isNegative = null)
{
- PHPUnit_Framework_Assert::assertNull($path);
- PHPUnit_Framework_Assert::assertNull($isNegative);
- PHPUnit_Framework_Assert::assertNotNull($json);
+ PHPUnit\Framework\Assert::assertNull($path);
+ PHPUnit\Framework\Assert::assertNull($isNegative);
+ PHPUnit\Framework\Assert::assertNotNull($json);
}
}
"""
@@ -523,7 +523,7 @@ Feature: Step Definition Pattern
* @Given I have a package v:version
*/
public function multipleWrongNamedParameters($version) {
- PHPUnit_Framework_Assert::assertEquals('2.5', $version);
+ PHPUnit\Framework\Assert::assertEquals('2.5', $version);
}
}
"""
@@ -555,7 +555,7 @@ Feature: Step Definition Pattern
* @When I enter the string :input
*/
public function multipleWrongNamedParameters($input) {
- PHPUnit_Framework_Assert::assertEquals('', $input);
+ PHPUnit\Framework\Assert::assertEquals('', $input);
}
}
"""
@@ -587,8 +587,8 @@ Feature: Step Definition Pattern
* @Then images should be uploaded to web\/uploads\/media\/default\/:arg1\/:arg2\/
*/
public function multipleWrongNamedParameters($arg1, $arg2) {
- PHPUnit_Framework_Assert::assertEquals('0001', $arg1);
- PHPUnit_Framework_Assert::assertEquals('01', $arg2);
+ PHPUnit\Framework\Assert::assertEquals('0001', $arg1);
+ PHPUnit\Framework\Assert::assertEquals('01', $arg2);
}
}
"""
@@ -620,7 +620,7 @@ Feature: Step Definition Pattern
* @Given I have a negative number :num
*/
public function multipleWrongNamedParameters($num) {
- PHPUnit_Framework_Assert::assertEquals('-3', $num);
+ PHPUnit\Framework\Assert::assertEquals('-3', $num);
}
}
"""
diff --git a/features/definitions_transformations.feature b/features/definitions_transformations.feature
index ff986a4ce..92c4e6f25 100644
--- a/features/definitions_transformations.feature
+++ b/features/definitions_transformations.feature
@@ -117,29 +117,29 @@ Feature: Step Arguments Transformations
* @Then /Username must be "([^"]+)"/
*/
public function usernameMustBe($username) {
- PHPUnit_Framework_Assert::assertEquals($username, $this->user->getUsername());
+ PHPUnit\Framework\Assert::assertEquals($username, $this->user->getUsername());
}
/**
* @Then /Age must be (\d+)/
*/
public function ageMustBe($age) {
- PHPUnit_Framework_Assert::assertEquals($age, $this->user->getAge());
- PHPUnit_Framework_Assert::assertInternalType('int', $age);
+ PHPUnit\Framework\Assert::assertEquals($age, $this->user->getAge());
+ PHPUnit\Framework\Assert::assertInternalType('int', $age);
}
/**
* @Then the Usernames must be:
*/
public function usernamesMustBe(array $usernames) {
- PHPUnit_Framework_Assert::assertEquals($usernames[0], $this->user->getUsername());
+ PHPUnit\Framework\Assert::assertEquals($usernames[0], $this->user->getUsername());
}
/**
* @Then /^the boolean (no) should be transformed to false$/
*/
public function theBooleanShouldBeTransformed($boolean) {
- PHPUnit_Framework_Assert::assertSame(false, $boolean);
+ PHPUnit\Framework\Assert::assertSame(false, $boolean);
}
}
"""
@@ -289,7 +289,7 @@ Feature: Step Arguments Transformations
/** @Then the :field should be :value */
public function theFieldShouldBe($field, $value) {
- PHPUnit_Framework_Assert::assertSame($value, $this->data[0][$field]);
+ PHPUnit\Framework\Assert::assertSame($value, $this->data[0][$field]);
}
}
"""
diff --git a/features/definitions_translations.feature b/features/definitions_translations.feature
index df41e942f..c3ace9d05 100644
--- a/features/definitions_translations.feature
+++ b/features/definitions_translations.feature
@@ -47,7 +47,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -59,7 +59,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -150,7 +150,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -162,7 +162,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -231,7 +231,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -243,7 +243,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -321,7 +321,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -333,7 +333,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
diff --git a/features/error_reporting.feature b/features/error_reporting.feature
index c3b859479..1139b48bc 100644
--- a/features/error_reporting.feature
+++ b/features/error_reporting.feature
@@ -37,7 +37,7 @@ Feature: Error Reporting
*/
public function iShouldGetNull()
{
- PHPUnit_Framework_Assert::assertNull($this->result);
+ PHPUnit\Framework\Assert::assertNull($this->result);
}
/**
@@ -53,7 +53,7 @@ Feature: Error Reporting
*/
public function iShouldGet($arg1)
{
- PHPUnit_Framework_Assert::assertEquals($arg1, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($arg1, $this->result);
}
}
diff --git a/features/extensions.feature b/features/extensions.feature
index 5fb9de911..9d5bd2f3f 100644
--- a/features/extensions.feature
+++ b/features/extensions.feature
@@ -31,7 +31,7 @@ Feature: Extensions
/** @Then the extension should be loaded */
public function theExtensionLoaded() {
- PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
+ PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
}
}
"""
diff --git a/features/format_options.feature b/features/format_options.feature
index ce773fa0b..f523e42c9 100644
--- a/features/format_options.feature
+++ b/features/format_options.feature
@@ -47,22 +47,22 @@ Feature: Format options
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 934a6bbf9..ce6bd6bb9 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -47,7 +47,7 @@ Feature: Per-suite helper containers
/** @Given service has no state */
public function noState() {
- PHPUnit_Framework_Assert::assertNull($this->service->number);
+ PHPUnit\Framework\Assert::assertNull($this->service->number);
}
/** @When service gets a state of :number in first context */
@@ -67,7 +67,7 @@ Feature: Per-suite helper containers
/** @Then service should have a state of :number in second context */
public function checkState($number) {
- PHPUnit_Framework_Assert::assertSame($number, $this->service->number);
+ PHPUnit\Framework\Assert::assertSame($number, $this->service->number);
}
}
"""
diff --git a/features/hooks.feature b/features/hooks.feature
index 557969e4e..20066b000 100644
--- a/features/hooks.feature
+++ b/features/hooks.feature
@@ -101,7 +101,7 @@ Feature: hooks
* @Then /^I must have (\d+)$/
*/
public function iMustHave($number) {
- \PHPUnit_Framework_Assert::assertEquals(intval($number), $this->number);
+ \PHPUnit\Framework\Assert::assertEquals(intval($number), $this->number);
}
}
"""
diff --git a/features/i18n.feature b/features/i18n.feature
index b130b82e2..1856d204f 100644
--- a/features/i18n.feature
+++ b/features/i18n.feature
@@ -28,7 +28,7 @@ Feature: I18n
* @Then /Я должен иметь (\d+)/
*/
public function iShouldHave($number) {
- PHPUnit_Framework_Assert::assertEquals(intval($number), $this->value);
+ PHPUnit\Framework\Assert::assertEquals(intval($number), $this->value);
}
/**
diff --git a/features/junit_format.feature b/features/junit_format.feature
index f9e4bfd88..180cd5a27 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -26,7 +26,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -151,7 +151,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -223,7 +223,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -303,7 +303,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -333,7 +333,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -486,7 +486,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -550,7 +550,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEqual($num, $this->value);
+ PHPUnit\Framework\Assert::assertEqual($num, $this->value);
}
/**
@@ -578,7 +578,7 @@
When I run "behat --no-colors -f junit -o junit"
Then it should fail with:
"""
- Call to undefined method PHPUnit_Framework_Assert::assertEqual
+ Call to undefined method PHPUnit\Framework\Assert::assertEqual
"""
And "junit/default.xml" file xml should be like:
"""
diff --git a/features/multiple_formats.feature b/features/multiple_formats.feature
index 1ef068178..ecbb2605c 100644
--- a/features/multiple_formats.feature
+++ b/features/multiple_formats.feature
@@ -47,22 +47,22 @@ Feature: Multiple formats
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/outlines.feature b/features/outlines.feature
index 148f9ab7c..352fca98c 100644
--- a/features/outlines.feature
+++ b/features/outlines.feature
@@ -80,7 +80,7 @@ Feature: Scenario Outlines
* @Then /^The result should be (\d+)$/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
}
"""
@@ -242,7 +242,7 @@ Feature: Scenario Outlines
* @Then the result should be :result
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->number);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->number);
}
}
"""
diff --git a/features/parameters.feature b/features/parameters.feature
index b60550dcc..784c542ac 100644
--- a/features/parameters.feature
+++ b/features/parameters.feature
@@ -53,7 +53,7 @@ Feature: Parameters
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals($result, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/pretty_format.feature b/features/pretty_format.feature
index 1bfa914ca..6f7a575ee 100644
--- a/features/pretty_format.feature
+++ b/features/pretty_format.feature
@@ -28,7 +28,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -163,7 +163,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -245,7 +245,7 @@ Feature: Pretty Formatter
* @Then /I must have "([^"]+)"/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
+ PHPUnit\Framework\Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
}
/**
diff --git a/features/profiles.feature b/features/profiles.feature
index 481b3a9d6..6b726437b 100644
--- a/features/profiles.feature
+++ b/features/profiles.feature
@@ -51,7 +51,7 @@ Feature: Profiles
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals($result, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/rerun.feature b/features/rerun.feature
index e835b8e0d..0aa3000c4 100644
--- a/features/rerun.feature
+++ b/features/rerun.feature
@@ -44,22 +44,22 @@ Feature: Rerun
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/rerun_with_multiple_suite.feature b/features/rerun_with_multiple_suite.feature
index feb04dfa4..a706b8d1e 100644
--- a/features/rerun_with_multiple_suite.feature
+++ b/features/rerun_with_multiple_suite.feature
@@ -60,22 +60,22 @@ Feature: Rerun with multiple suite
* @Then /^I should have (\d+) (apples|bananas)$/
*/
public function iShouldHaveFruit($count, $fruit) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->fruits[$fruit]);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->fruits[$fruit]);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/result_types.feature b/features/result_types.feature
index 3467b6eaf..04feb95a5 100644
--- a/features/result_types.feature
+++ b/features/result_types.feature
@@ -236,7 +236,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit_Framework_Assert::assertEquals($money, $this->money);
+ PHPUnit\Framework\Assert::assertEquals($money, $this->money);
}
}
"""
@@ -324,7 +324,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit_Framework_Assert::assertEquals($money, $this->money);
+ PHPUnit\Framework\Assert::assertEquals($money, $this->money);
}
}
"""
diff --git a/features/traits.feature b/features/traits.feature
index 0c2157cef..dc2c6a519 100644
--- a/features/traits.feature
+++ b/features/traits.feature
@@ -49,7 +49,7 @@ Feature: Support php 5.4 traits
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
}
"""
diff --git a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
index e260b7596..84b8dd18f 100644
--- a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
+++ b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
@@ -5,8 +5,9 @@
use Behat\Testwork\Specification\GroupedSpecificationIterator;
use Behat\Testwork\Specification\NoSpecificationsIterator;
use Behat\Testwork\Specification\SpecificationArrayIterator;
+use PHPUnit\Framework\TestCase;
-class GroupedSubjectIteratorTest extends \PHPUnit_Framework_TestCase
+class GroupedSubjectIteratorTest extends TestCase
{
public function testIterationWithEmptyAtBeginning()
{
From acf07c6341f4ec4e200f9383d2ca190d65d25179 Mon Sep 17 00:00:00 2001
From: everzet
Date: Wed, 30 Aug 2017 16:59:45 +0100
Subject: [PATCH 063/567] Revert "Upgrade internal test suite to modern
phpunit"
This reverts commit 905dddc5e7d1bf489c82c473e0b3953b1d4d35e7.
---
composer.json | 2 +-
features/append_snippets.feature | 48 +++++++--------
features/arguments.feature | 8 +--
features/bootstrap/FeatureContext.php | 31 +++++-----
features/config_inheritance.feature | 4 +-
features/context.feature | 8 +--
features/definitions_patterns.feature | 58 +++++++++----------
features/definitions_transformations.feature | 12 ++--
features/definitions_translations.feature | 16 ++---
features/error_reporting.feature | 4 +-
features/extensions.feature | 2 +-
features/format_options.feature | 8 +--
features/helper_containers.feature | 4 +-
features/hooks.feature | 2 +-
features/i18n.feature | 2 +-
features/junit_format.feature | 16 ++---
features/multiple_formats.feature | 8 +--
features/outlines.feature | 4 +-
features/parameters.feature | 2 +-
features/pretty_format.feature | 6 +-
features/profiles.feature | 2 +-
features/rerun.feature | 8 +--
features/rerun_with_multiple_suite.feature | 8 +--
features/result_types.feature | 4 +-
features/traits.feature | 2 +-
.../Subject/GroupedSubjectIteratorTest.php | 3 +-
26 files changed, 135 insertions(+), 137 deletions(-)
diff --git a/composer.json b/composer.json
index a056e594b..b3dbd81f3 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"require-dev": {
"symfony/process": "~2.5|~3.0",
- "phpunit/phpunit": "~6.3",
+ "phpunit/phpunit": "~4.5",
"herrera-io/box": "~1.6.1"
},
diff --git a/features/append_snippets.feature b/features/append_snippets.feature
index e1727bdb4..8eb9390ec 100644
--- a/features/append_snippets.feature
+++ b/features/append_snippets.feature
@@ -47,22 +47,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -162,22 +162,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -267,22 +267,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -332,22 +332,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -435,22 +435,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -500,22 +500,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
diff --git a/features/arguments.feature b/features/arguments.feature
index 161a18111..6da60915a 100644
--- a/features/arguments.feature
+++ b/features/arguments.feature
@@ -44,22 +44,22 @@ Feature: Step Arguments
* @Then /^it must be equals to string (\d+)$/
*/
public function itMustBeEqualsToString($number) {
- \PHPUnit\Framework\Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
+ \PHPUnit_Framework_Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
}
/**
* @Then /^it must be equals to table (\d+)$/
*/
public function itMustBeEqualsToTable($number) {
- \PHPUnit\Framework\Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
+ \PHPUnit_Framework_Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
}
/**
* @Given /^I have number2 = (?P\d+) and number1 = (?P\d+)$/
*/
public function iHaveNumberAndNumber($number1, $number2) {
- \PHPUnit\Framework\Assert::assertEquals(13, intval($number1));
- \PHPUnit\Framework\Assert::assertEquals(243, intval($number2));
+ \PHPUnit_Framework_Assert::assertEquals(13, intval($number1));
+ \PHPUnit_Framework_Assert::assertEquals(243, intval($number2));
}
}
"""
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 11905b956..629c6fc21 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -10,7 +10,6 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
-use PHPUnit\Framework\Assert;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -120,12 +119,12 @@ class FeatureContext implements Context
$this->createFile($this->workingDir . '/' . $filename, $content);
}
- /**
- * Creates a noop feature in current workdir.
- *
- * @Given /^(?:there is )?a some feature scenarios/
- */
- public function aNoopFeature()
+ /**
+ * Creates a noop feature in current workdir.
+ *
+ * @Given /^(?:there is )?a some feature scenarios/
+ */
+ public function aNoopFeature()
{
$filename = 'features/bootstrap/FeatureContext.php';
$content = <<<'EOL'
@@ -157,7 +156,7 @@ public function iAmInThePath($path)
*/
public function fileShouldExist($path)
{
- Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
+ PHPUnit_Framework_Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
}
/**
@@ -259,7 +258,7 @@ public function itShouldPassWith($success, PyStringNode $text)
public function itShouldPassWithNoOutput($success)
{
$this->itShouldFail($success);
- Assert::assertEmpty($this->getOutput());
+ PHPUnit_Framework_Assert::assertEmpty($this->getOutput());
}
/**
@@ -273,7 +272,7 @@ public function itShouldPassWithNoOutput($success)
public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- Assert::assertFileExists($path);
+ PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
@@ -281,7 +280,7 @@ public function fileShouldContain($path, PyStringNode $text)
$fileContent = str_replace(PHP_EOL, "\n", $fileContent);
}
- Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
+ PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
}
/**
@@ -295,7 +294,7 @@ public function fileShouldContain($path, PyStringNode $text)
public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- Assert::assertFileExists($path);
+ PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
@@ -303,7 +302,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
$dom->loadXML($text);
$dom->formatOutput = true;
- Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
+ PHPUnit_Framework_Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
}
@@ -316,7 +315,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
*/
public function theOutputShouldContain(PyStringNode $text)
{
- Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
+ PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
}
private function getExpectedOutput(PyStringNode $expectedText)
@@ -364,13 +363,13 @@ public function itShouldFail($success)
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- Assert::assertNotEquals(0, $this->getExitCode());
+ PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
} else {
if (0 !== $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- Assert::assertEquals(0, $this->getExitCode());
+ PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
}
}
diff --git a/features/config_inheritance.feature b/features/config_inheritance.feature
index 16d6cb5e6..c418ad404 100644
--- a/features/config_inheritance.feature
+++ b/features/config_inheritance.feature
@@ -73,12 +73,12 @@ Feature: Config inheritance
/** @Then the context parameters should be overwritten */
public function theContextParametersOverwrite() {
- \PHPUnit\Framework\Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
+ \PHPUnit_Framework_Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
}
/** @Then the extension config should be merged */
public function theExtensionConfigMerge() {
- \PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
+ \PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
}
}
"""
diff --git a/features/context.feature b/features/context.feature
index eae21a44a..e96118009 100644
--- a/features/context.feature
+++ b/features/context.feature
@@ -47,22 +47,22 @@ Feature: Context consistency
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
diff --git a/features/definitions_patterns.feature b/features/definitions_patterns.feature
index 66eeb73d2..66d4d553f 100644
--- a/features/definitions_patterns.feature
+++ b/features/definitions_patterns.feature
@@ -158,8 +158,8 @@ Feature: Step Definition Pattern
* @Given only second :second
*/
public function invalidRegex($first = 'foo', $second = 'fiz') {
- PHPUnit\Framework\Assert::assertEquals('foo', $first);
- PHPUnit\Framework\Assert::assertEquals('bar', $second);
+ PHPUnit_Framework_Assert::assertEquals('foo', $first);
+ PHPUnit_Framework_Assert::assertEquals('bar', $second);
}
}
"""
@@ -192,7 +192,7 @@ Feature: Step Definition Pattern
* @Given I can provide parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit\Framework\Assert::assertNull($param);
+ PHPUnit_Framework_Assert::assertNull($param);
}
}
"""
@@ -256,7 +256,7 @@ Feature: Step Definition Pattern
* parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit\Framework\Assert::assertNull($param);
+ PHPUnit_Framework_Assert::assertNull($param);
}
}
"""
@@ -295,8 +295,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $param2) {
- PHPUnit\Framework\Assert::assertEquals('one', $param1);
- PHPUnit\Framework\Assert::assertEquals('two', $param2);
+ PHPUnit_Framework_Assert::assertEquals('one', $param1);
+ PHPUnit_Framework_Assert::assertEquals('two', $param2);
}
}
"""
@@ -328,8 +328,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $someParam) {
- PHPUnit\Framework\Assert::assertEquals('two', $param1);
- PHPUnit\Framework\Assert::assertEquals('one', $someParam);
+ PHPUnit_Framework_Assert::assertEquals('two', $param1);
+ PHPUnit_Framework_Assert::assertEquals('one', $someParam);
}
}
"""
@@ -361,9 +361,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count) {
- PHPUnit\Framework\Assert::assertEquals('two', $param1);
- PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
- PHPUnit\Framework\Assert::assertEquals(2, $count);
+ PHPUnit_Framework_Assert::assertEquals('two', $param1);
+ PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
+ PHPUnit_Framework_Assert::assertEquals(2, $count);
}
}
"""
@@ -395,10 +395,10 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam with:
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count, $string) {
- PHPUnit\Framework\Assert::assertEquals('two', $param1);
- PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
- PHPUnit\Framework\Assert::assertEquals(2, $count);
- PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
+ PHPUnit_Framework_Assert::assertEquals('two', $param1);
+ PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
+ PHPUnit_Framework_Assert::assertEquals(2, $count);
+ PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -433,9 +433,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters for :name:
*/
public function multipleWrongNamedParameters($count, $name, $string) {
- PHPUnit\Framework\Assert::assertEquals('2', $count);
- PHPUnit\Framework\Assert::assertEquals('thing', $name);
- PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
+ PHPUnit_Framework_Assert::assertEquals('2', $count);
+ PHPUnit_Framework_Assert::assertEquals('thing', $name);
+ PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -472,9 +472,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality($path = null, $isNegative = null, PyStringNode $json = null)
{
- PHPUnit\Framework\Assert::assertNull($path);
- PHPUnit\Framework\Assert::assertNull($isNegative);
- PHPUnit\Framework\Assert::assertNotNull($json);
+ PHPUnit_Framework_Assert::assertNull($path);
+ PHPUnit_Framework_Assert::assertNull($isNegative);
+ PHPUnit_Framework_Assert::assertNotNull($json);
}
/**
@@ -482,9 +482,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality2($json = null, $path = null, $isNegative = null)
{
- PHPUnit\Framework\Assert::assertNull($path);
- PHPUnit\Framework\Assert::assertNull($isNegative);
- PHPUnit\Framework\Assert::assertNotNull($json);
+ PHPUnit_Framework_Assert::assertNull($path);
+ PHPUnit_Framework_Assert::assertNull($isNegative);
+ PHPUnit_Framework_Assert::assertNotNull($json);
}
}
"""
@@ -523,7 +523,7 @@ Feature: Step Definition Pattern
* @Given I have a package v:version
*/
public function multipleWrongNamedParameters($version) {
- PHPUnit\Framework\Assert::assertEquals('2.5', $version);
+ PHPUnit_Framework_Assert::assertEquals('2.5', $version);
}
}
"""
@@ -555,7 +555,7 @@ Feature: Step Definition Pattern
* @When I enter the string :input
*/
public function multipleWrongNamedParameters($input) {
- PHPUnit\Framework\Assert::assertEquals('', $input);
+ PHPUnit_Framework_Assert::assertEquals('', $input);
}
}
"""
@@ -587,8 +587,8 @@ Feature: Step Definition Pattern
* @Then images should be uploaded to web\/uploads\/media\/default\/:arg1\/:arg2\/
*/
public function multipleWrongNamedParameters($arg1, $arg2) {
- PHPUnit\Framework\Assert::assertEquals('0001', $arg1);
- PHPUnit\Framework\Assert::assertEquals('01', $arg2);
+ PHPUnit_Framework_Assert::assertEquals('0001', $arg1);
+ PHPUnit_Framework_Assert::assertEquals('01', $arg2);
}
}
"""
@@ -620,7 +620,7 @@ Feature: Step Definition Pattern
* @Given I have a negative number :num
*/
public function multipleWrongNamedParameters($num) {
- PHPUnit\Framework\Assert::assertEquals('-3', $num);
+ PHPUnit_Framework_Assert::assertEquals('-3', $num);
}
}
"""
diff --git a/features/definitions_transformations.feature b/features/definitions_transformations.feature
index 92c4e6f25..ff986a4ce 100644
--- a/features/definitions_transformations.feature
+++ b/features/definitions_transformations.feature
@@ -117,29 +117,29 @@ Feature: Step Arguments Transformations
* @Then /Username must be "([^"]+)"/
*/
public function usernameMustBe($username) {
- PHPUnit\Framework\Assert::assertEquals($username, $this->user->getUsername());
+ PHPUnit_Framework_Assert::assertEquals($username, $this->user->getUsername());
}
/**
* @Then /Age must be (\d+)/
*/
public function ageMustBe($age) {
- PHPUnit\Framework\Assert::assertEquals($age, $this->user->getAge());
- PHPUnit\Framework\Assert::assertInternalType('int', $age);
+ PHPUnit_Framework_Assert::assertEquals($age, $this->user->getAge());
+ PHPUnit_Framework_Assert::assertInternalType('int', $age);
}
/**
* @Then the Usernames must be:
*/
public function usernamesMustBe(array $usernames) {
- PHPUnit\Framework\Assert::assertEquals($usernames[0], $this->user->getUsername());
+ PHPUnit_Framework_Assert::assertEquals($usernames[0], $this->user->getUsername());
}
/**
* @Then /^the boolean (no) should be transformed to false$/
*/
public function theBooleanShouldBeTransformed($boolean) {
- PHPUnit\Framework\Assert::assertSame(false, $boolean);
+ PHPUnit_Framework_Assert::assertSame(false, $boolean);
}
}
"""
@@ -289,7 +289,7 @@ Feature: Step Arguments Transformations
/** @Then the :field should be :value */
public function theFieldShouldBe($field, $value) {
- PHPUnit\Framework\Assert::assertSame($value, $this->data[0][$field]);
+ PHPUnit_Framework_Assert::assertSame($value, $this->data[0][$field]);
}
}
"""
diff --git a/features/definitions_translations.feature b/features/definitions_translations.feature
index c3ace9d05..df41e942f 100644
--- a/features/definitions_translations.feature
+++ b/features/definitions_translations.feature
@@ -47,7 +47,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -59,7 +59,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit\Framework\Assert::assertEquals($username, $user->name);
+ PHPUnit_Framework_Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -150,7 +150,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -162,7 +162,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit\Framework\Assert::assertEquals($username, $user->name);
+ PHPUnit_Framework_Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -231,7 +231,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -243,7 +243,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit\Framework\Assert::assertEquals($username, $user->name);
+ PHPUnit_Framework_Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -321,7 +321,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -333,7 +333,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit\Framework\Assert::assertEquals($username, $user->name);
+ PHPUnit_Framework_Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
diff --git a/features/error_reporting.feature b/features/error_reporting.feature
index 1139b48bc..c3b859479 100644
--- a/features/error_reporting.feature
+++ b/features/error_reporting.feature
@@ -37,7 +37,7 @@ Feature: Error Reporting
*/
public function iShouldGetNull()
{
- PHPUnit\Framework\Assert::assertNull($this->result);
+ PHPUnit_Framework_Assert::assertNull($this->result);
}
/**
@@ -53,7 +53,7 @@ Feature: Error Reporting
*/
public function iShouldGet($arg1)
{
- PHPUnit\Framework\Assert::assertEquals($arg1, $this->result);
+ PHPUnit_Framework_Assert::assertEquals($arg1, $this->result);
}
}
diff --git a/features/extensions.feature b/features/extensions.feature
index 9d5bd2f3f..5fb9de911 100644
--- a/features/extensions.feature
+++ b/features/extensions.feature
@@ -31,7 +31,7 @@ Feature: Extensions
/** @Then the extension should be loaded */
public function theExtensionLoaded() {
- PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
+ PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
}
}
"""
diff --git a/features/format_options.feature b/features/format_options.feature
index f523e42c9..ce773fa0b 100644
--- a/features/format_options.feature
+++ b/features/format_options.feature
@@ -47,22 +47,22 @@ Feature: Format options
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index ce6bd6bb9..934a6bbf9 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -47,7 +47,7 @@ Feature: Per-suite helper containers
/** @Given service has no state */
public function noState() {
- PHPUnit\Framework\Assert::assertNull($this->service->number);
+ PHPUnit_Framework_Assert::assertNull($this->service->number);
}
/** @When service gets a state of :number in first context */
@@ -67,7 +67,7 @@ Feature: Per-suite helper containers
/** @Then service should have a state of :number in second context */
public function checkState($number) {
- PHPUnit\Framework\Assert::assertSame($number, $this->service->number);
+ PHPUnit_Framework_Assert::assertSame($number, $this->service->number);
}
}
"""
diff --git a/features/hooks.feature b/features/hooks.feature
index 20066b000..557969e4e 100644
--- a/features/hooks.feature
+++ b/features/hooks.feature
@@ -101,7 +101,7 @@ Feature: hooks
* @Then /^I must have (\d+)$/
*/
public function iMustHave($number) {
- \PHPUnit\Framework\Assert::assertEquals(intval($number), $this->number);
+ \PHPUnit_Framework_Assert::assertEquals(intval($number), $this->number);
}
}
"""
diff --git a/features/i18n.feature b/features/i18n.feature
index 1856d204f..b130b82e2 100644
--- a/features/i18n.feature
+++ b/features/i18n.feature
@@ -28,7 +28,7 @@ Feature: I18n
* @Then /Я должен иметь (\d+)/
*/
public function iShouldHave($number) {
- PHPUnit\Framework\Assert::assertEquals(intval($number), $this->value);
+ PHPUnit_Framework_Assert::assertEquals(intval($number), $this->value);
}
/**
diff --git a/features/junit_format.feature b/features/junit_format.feature
index 180cd5a27..f9e4bfd88 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -26,7 +26,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -151,7 +151,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -223,7 +223,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -303,7 +303,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -333,7 +333,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -486,7 +486,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -550,7 +550,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEqual($num, $this->value);
+ PHPUnit_Framework_Assert::assertEqual($num, $this->value);
}
/**
@@ -578,7 +578,7 @@
When I run "behat --no-colors -f junit -o junit"
Then it should fail with:
"""
- Call to undefined method PHPUnit\Framework\Assert::assertEqual
+ Call to undefined method PHPUnit_Framework_Assert::assertEqual
"""
And "junit/default.xml" file xml should be like:
"""
diff --git a/features/multiple_formats.feature b/features/multiple_formats.feature
index ecbb2605c..1ef068178 100644
--- a/features/multiple_formats.feature
+++ b/features/multiple_formats.feature
@@ -47,22 +47,22 @@ Feature: Multiple formats
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/outlines.feature b/features/outlines.feature
index 352fca98c..148f9ab7c 100644
--- a/features/outlines.feature
+++ b/features/outlines.feature
@@ -80,7 +80,7 @@ Feature: Scenario Outlines
* @Then /^The result should be (\d+)$/
*/
public function theResultShouldBe($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
}
}
"""
@@ -242,7 +242,7 @@ Feature: Scenario Outlines
* @Then the result should be :result
*/
public function theResultShouldBe($result) {
- PHPUnit\Framework\Assert::assertEquals(intval($result), $this->number);
+ PHPUnit_Framework_Assert::assertEquals(intval($result), $this->number);
}
}
"""
diff --git a/features/parameters.feature b/features/parameters.feature
index 784c542ac..b60550dcc 100644
--- a/features/parameters.feature
+++ b/features/parameters.feature
@@ -53,7 +53,7 @@ Feature: Parameters
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit\Framework\Assert::assertEquals($result, $this->result);
+ PHPUnit_Framework_Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/pretty_format.feature b/features/pretty_format.feature
index 6f7a575ee..1bfa914ca 100644
--- a/features/pretty_format.feature
+++ b/features/pretty_format.feature
@@ -28,7 +28,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -163,7 +163,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals($num, $this->value);
+ PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
@@ -245,7 +245,7 @@ Feature: Pretty Formatter
* @Then /I must have "([^"]+)"/
*/
public function iMustHave($num) {
- PHPUnit\Framework\Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
+ PHPUnit_Framework_Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
}
/**
diff --git a/features/profiles.feature b/features/profiles.feature
index 6b726437b..481b3a9d6 100644
--- a/features/profiles.feature
+++ b/features/profiles.feature
@@ -51,7 +51,7 @@ Feature: Profiles
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit\Framework\Assert::assertEquals($result, $this->result);
+ PHPUnit_Framework_Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/rerun.feature b/features/rerun.feature
index 0aa3000c4..e835b8e0d 100644
--- a/features/rerun.feature
+++ b/features/rerun.feature
@@ -44,22 +44,22 @@ Feature: Rerun
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/rerun_with_multiple_suite.feature b/features/rerun_with_multiple_suite.feature
index a706b8d1e..feb04dfa4 100644
--- a/features/rerun_with_multiple_suite.feature
+++ b/features/rerun_with_multiple_suite.feature
@@ -60,22 +60,22 @@ Feature: Rerun with multiple suite
* @Then /^I should have (\d+) (apples|bananas)$/
*/
public function iShouldHaveFruit($count, $fruit) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->fruits[$fruit]);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->fruits[$fruit]);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/result_types.feature b/features/result_types.feature
index 04feb95a5..3467b6eaf 100644
--- a/features/result_types.feature
+++ b/features/result_types.feature
@@ -236,7 +236,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit\Framework\Assert::assertEquals($money, $this->money);
+ PHPUnit_Framework_Assert::assertEquals($money, $this->money);
}
}
"""
@@ -324,7 +324,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit\Framework\Assert::assertEquals($money, $this->money);
+ PHPUnit_Framework_Assert::assertEquals($money, $this->money);
}
}
"""
diff --git a/features/traits.feature b/features/traits.feature
index dc2c6a519..0c2157cef 100644
--- a/features/traits.feature
+++ b/features/traits.feature
@@ -49,7 +49,7 @@ Feature: Support php 5.4 traits
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
}
"""
diff --git a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
index 84b8dd18f..e260b7596 100644
--- a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
+++ b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
@@ -5,9 +5,8 @@
use Behat\Testwork\Specification\GroupedSpecificationIterator;
use Behat\Testwork\Specification\NoSpecificationsIterator;
use Behat\Testwork\Specification\SpecificationArrayIterator;
-use PHPUnit\Framework\TestCase;
-class GroupedSubjectIteratorTest extends TestCase
+class GroupedSubjectIteratorTest extends \PHPUnit_Framework_TestCase
{
public function testIterationWithEmptyAtBeginning()
{
From df8838aa221554e473fd61b3f0ee442776cb799a Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 09:06:58 +0100
Subject: [PATCH 064/567] Use logo repository logo
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e71a77b4e..550ee8185 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
Behat is a BDD framework for PHP to help you test business expectations.
From 1d426006388f6523bd715de98c4f48d8d6609704 Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 09:07:36 +0100
Subject: [PATCH 065/567] Use smaller version of logo
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 550ee8185..4159ab7df 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
Behat is a BDD framework for PHP to help you test business expectations.
From 44b6de275cf5b593049ed62c4881e55378ca9c7a Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 09:08:26 +0100
Subject: [PATCH 066/567] Remove broken HHVM badge
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 4159ab7df..22543cb51 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,6 @@ Behat is a BDD framework for PHP to help you test business expectations.
[](https://packagist.org/packages/behat/behat)
[](https://travis-ci.org/Behat/Behat)
[](https://ci.appveyor.com/project/everzet/behat/branch/master)
-[](http://hhvm.h4cc.de/package/behat/behat)
[](https://scrutinizer-ci.com/g/Behat/Behat/)
Installing Behat
From 237bd0b4d9057679ae8eb316e1ffcfa6d6bfc2ac Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 11:13:46 +0100
Subject: [PATCH 067/567] Extract argument Validator from Organiser
---
src/Behat/Behat/Context/ContextFactory.php | 12 +++-
.../Argument/MixedArgumentOrganiser.php | 58 +--------------
src/Behat/Testwork/Argument/Validator.php | 70 +++++++++++++++++++
3 files changed, 81 insertions(+), 59 deletions(-)
create mode 100644 src/Behat/Testwork/Argument/Validator.php
diff --git a/src/Behat/Behat/Context/ContextFactory.php b/src/Behat/Behat/Context/ContextFactory.php
index ff255d19c..e9f5baaf7 100644
--- a/src/Behat/Behat/Context/ContextFactory.php
+++ b/src/Behat/Behat/Context/ContextFactory.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\Context;
+use Behat\Testwork\Argument\Validator;
use Behat\Behat\Context\Argument\ArgumentResolver;
use Behat\Behat\Context\Initializer\ContextInitializer;
use Behat\Testwork\Argument\ArgumentOrganiser;
@@ -34,6 +35,10 @@ final class ContextFactory
* @var ContextInitializer[]
*/
private $contextInitializers = array();
+ /**
+ * @var Validator
+ */
+ private $validator;
/**
* Initialises factory.
@@ -43,6 +48,7 @@ final class ContextFactory
public function __construct(ArgumentOrganiser $argumentOrganiser)
{
$this->argumentOrganiser = $argumentOrganiser;
+ $this->validator = new Validator();
}
/**
@@ -100,13 +106,15 @@ private function resolveArguments(ReflectionClass $reflection, array $arguments,
$arguments = $resolver->resolveArguments($reflection, $arguments);
}
- if (!$reflection->hasMethod('__construct') || !count($arguments)) {
+ if (!$reflection->hasMethod('__construct')) {
return $arguments;
}
$constructor = $reflection->getConstructor();
+ $arguments = $this->argumentOrganiser->organiseArguments($constructor, $arguments);
+ $this->validator->validateArguments($constructor, $arguments);
- return $this->argumentOrganiser->organiseArguments($constructor, $arguments);
+ return $arguments;
}
/**
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index e50f47a7f..bc116ddd2 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -10,10 +10,8 @@
namespace Behat\Testwork\Argument;
-use Behat\Testwork\Argument\Exception\UnknownParameterValueException;
use ReflectionFunctionAbstract;
use ReflectionClass;
-use ReflectionMethod;
use ReflectionParameter;
/**
@@ -35,12 +33,7 @@ final class MixedArgumentOrganiser implements ArgumentOrganiser
*/
public function organiseArguments(ReflectionFunctionAbstract $function, array $arguments)
{
- $parameters = $function->getParameters();
- $arguments = $this->prepareArguments($parameters, $arguments);
-
- $this->validateArguments($function, $parameters, $arguments);
-
- return $arguments;
+ return $this->prepareArguments($function->getParameters(), $arguments);
}
/**
@@ -402,55 +395,6 @@ private function reorderArguments(array $parameters, array $arguments)
return $orderedArguments;
}
- /**
- * Validates that all arguments are in place, throws exception otherwise.
- *
- * @param ReflectionFunctionAbstract $function
- * @param ReflectionParameter[] $parameters
- * @param mixed[] $arguments
- *
- * @throws UnknownParameterValueException
- */
- private function validateArguments(
- ReflectionFunctionAbstract $function,
- array $parameters,
- array $arguments
- ) {
- foreach ($parameters as $num => $parameter) {
- $name = $parameter->getName();
-
- if (array_key_exists($num, $arguments) || array_key_exists($name, $arguments)) {
- continue;
- }
-
- throw new UnknownParameterValueException(sprintf(
- 'Can not find a matching value for an argument `$%s` of the method `%s`.',
- $name,
- $this->getFunctionPath($function)
- ));
- }
- }
-
- /**
- * Returns function path for a provided reflection.
- *
- * @param ReflectionFunctionAbstract $function
- *
- * @return string
- */
- private function getFunctionPath(ReflectionFunctionAbstract $function)
- {
- if ($function instanceof ReflectionMethod) {
- return sprintf(
- '%s::%s()',
- $function->getDeclaringClass()->getName(),
- $function->getName()
- );
- }
-
- return sprintf('%s()', $function->getName());
- }
-
/**
* Marks arguments at all positions as undefined.
*
diff --git a/src/Behat/Testwork/Argument/Validator.php b/src/Behat/Testwork/Argument/Validator.php
new file mode 100644
index 000000000..7e3bd1c60
--- /dev/null
+++ b/src/Behat/Testwork/Argument/Validator.php
@@ -0,0 +1,70 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Testwork\Argument;
+
+use Behat\Testwork\Argument\Exception\UnknownParameterValueException;
+use ReflectionFunctionAbstract;
+use ReflectionMethod;
+
+/**
+ * Validates function arguments.
+ *
+ * @author Konstantin Kudryashov
+ */
+final class Validator
+{
+ /**
+ * Validates that all arguments are in place, throws exception otherwise.
+ *
+ * @param ReflectionFunctionAbstract $function
+ * @param mixed[] $arguments
+ *
+ * @throws UnknownParameterValueException
+ */
+ public function validateArguments(ReflectionFunctionAbstract $function, array $arguments)
+ {
+ foreach ($function->getParameters() as $num => $parameter) {
+ $name = $parameter->getName();
+
+ if ($parameter->isDefaultValueAvailable()
+ || array_key_exists($num, $arguments)
+ || array_key_exists($name, $arguments)) {
+ continue;
+ }
+
+ throw new UnknownParameterValueException(sprintf(
+ 'Can not find a matching value for an argument `$%s` of the method `%s`.',
+ $name,
+ $this->getFunctionPath($function)
+ ));
+ }
+ }
+
+ /**
+ * Returns function path for a provided reflection.
+ *
+ * @param ReflectionFunctionAbstract $function
+ *
+ * @return string
+ */
+ private function getFunctionPath(ReflectionFunctionAbstract $function)
+ {
+ if ($function instanceof ReflectionMethod) {
+ return sprintf(
+ '%s::%s()',
+ $function->getDeclaringClass()->getName(),
+ $function->getName()
+ );
+ }
+
+ return sprintf('%s()', $function->getName());
+ }
+}
From 679b9a18b23979846205ac2e61946ac8169f375d Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 11:14:14 +0100
Subject: [PATCH 068/567] Use Validator to validate call arguments
---
src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
index 09267bbd4..62b3d1d6d 100644
--- a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
+++ b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
@@ -10,6 +10,7 @@
namespace Behat\Testwork\Call\Handler;
+use Behat\Testwork\Argument\Validator;
use Behat\Testwork\Call\Call;
use Behat\Testwork\Call\CallResult;
use Behat\Testwork\Call\Exception\CallErrorException;
@@ -26,11 +27,14 @@ final class RuntimeCallHandler implements CallHandler
* @var integer
*/
private $errorReportingLevel;
-
/**
* @var bool
*/
private $obStarted = false;
+ /**
+ * @var Validator
+ */
+ private $validator;
/**
* Initializes executor.
@@ -40,6 +44,7 @@ final class RuntimeCallHandler implements CallHandler
public function __construct($errorReportingLevel = E_ALL)
{
$this->errorReportingLevel = $errorReportingLevel;
+ $this->validator = new Validator();
}
/**
@@ -94,12 +99,13 @@ public function handleError($level, $message, $file, $line)
*/
private function executeCall(Call $call)
{
+ $reflection = $call->getCallee()->getReflection();
$callable = $call->getBoundCallable();
$arguments = $call->getArguments();
-
$return = $exception = null;
try {
+ $this->validator->validateArguments($reflection, $arguments);
$return = call_user_func_array($callable, $arguments);
} catch (Exception $caught) {
$exception = $caught;
From 7de680106c07243503daae63e96e279d2a88d8e6 Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 11:33:05 +0100
Subject: [PATCH 069/567] Post-refactoring cleanup
---
src/Behat/Behat/Context/ContextFactory.php | 12 ++++---
src/Behat/Testwork/Argument/Validator.php | 39 ++++++++++++++++------
2 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/src/Behat/Behat/Context/ContextFactory.php b/src/Behat/Behat/Context/ContextFactory.php
index e9f5baaf7..b7a24422e 100644
--- a/src/Behat/Behat/Context/ContextFactory.php
+++ b/src/Behat/Behat/Context/ContextFactory.php
@@ -102,19 +102,21 @@ public function createContext($class, array $arguments = array(), array $singleU
*/
private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers)
{
+ $newArguments = $arguments;
+
foreach ($resolvers as $resolver) {
- $arguments = $resolver->resolveArguments($reflection, $arguments);
+ $newArguments = $resolver->resolveArguments($reflection, $newArguments);
}
if (!$reflection->hasMethod('__construct')) {
- return $arguments;
+ return $newArguments;
}
$constructor = $reflection->getConstructor();
- $arguments = $this->argumentOrganiser->organiseArguments($constructor, $arguments);
- $this->validator->validateArguments($constructor, $arguments);
+ $newArguments = $this->argumentOrganiser->organiseArguments($constructor, $newArguments);
+ $this->validator->validateArguments($constructor, $newArguments);
- return $arguments;
+ return $newArguments;
}
/**
diff --git a/src/Behat/Testwork/Argument/Validator.php b/src/Behat/Testwork/Argument/Validator.php
index 7e3bd1c60..3d47e7e5a 100644
--- a/src/Behat/Testwork/Argument/Validator.php
+++ b/src/Behat/Testwork/Argument/Validator.php
@@ -13,6 +13,7 @@
use Behat\Testwork\Argument\Exception\UnknownParameterValueException;
use ReflectionFunctionAbstract;
use ReflectionMethod;
+use ReflectionParameter;
/**
* Validates function arguments.
@@ -32,20 +33,36 @@ final class Validator
public function validateArguments(ReflectionFunctionAbstract $function, array $arguments)
{
foreach ($function->getParameters() as $num => $parameter) {
- $name = $parameter->getName();
+ $this->validateArgument($parameter, $num, $arguments);
+ }
+ }
+
+ /**
+ * Validates given argument.
+ *
+ * @param ReflectionParameter $parameter
+ * @param integer $parameterIndex
+ * @param array $givenArguments
+ */
+ private function validateArgument(ReflectionParameter $parameter, $parameterIndex, array $givenArguments)
+ {
+ if ($parameter->isDefaultValueAvailable()) {
+ return;
+ }
- if ($parameter->isDefaultValueAvailable()
- || array_key_exists($num, $arguments)
- || array_key_exists($name, $arguments)) {
- continue;
- }
+ if (array_key_exists($parameterIndex, $givenArguments)) {
+ return;
+ }
- throw new UnknownParameterValueException(sprintf(
- 'Can not find a matching value for an argument `$%s` of the method `%s`.',
- $name,
- $this->getFunctionPath($function)
- ));
+ if (array_key_exists($parameter->getName(), $givenArguments)) {
+ return;
}
+
+ throw new UnknownParameterValueException(sprintf(
+ 'Can not find a matching value for an argument `$%s` of the method `%s`.',
+ $parameter->getName(),
+ $this->getFunctionPath($parameter->getDeclaringFunction())
+ ));
}
/**
From 2e1911bfaf41dde0244995335232478eaf5be5ad Mon Sep 17 00:00:00 2001
From: everzet
Date: Thu, 31 Aug 2017 11:34:00 +0100
Subject: [PATCH 070/567] Update CHANGELOG
[ci skip]
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18ff849a3..5392af5b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* [#1056](https://github.com/Behat/Behat/pull/1056): Make Gherkin aware of the
base path so it can filter correctly
+### Changed
+ * [#1069](https://github.com/Behat/Behat/pull/1069): Rework argument validators
+
### Deprecated
* [#1054](https://github.com/Behat/Behat/pull/1054): Deprecated usage
of `Interop\Container`. Versions prior to `1.2` are not supported, but `1.2`
From 78b54116c2901c500005e220a9f1f7b44f699021 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 09:45:27 +0100
Subject: [PATCH 071/567] Hold helper container instance on the Environment
---
.../Argument/ArgumentResolverFactory.php | 32 ++++++++++++++++
.../Behat/Context/Argument/NullFactory.php | 11 +++++-
.../Argument/SuiteScopedResolverFactory.php | 2 +
.../Handler/ContextEnvironmentHandler.php | 30 ++++++++++++---
.../InitializedContextEnvironment.php | 23 ++++++++++-
.../ServiceContainerEnvironment.php | 38 +++++++++++++++++++
.../Argument/ServicesResolverFactory.php | 25 +++++++++++-
7 files changed, 153 insertions(+), 8 deletions(-)
create mode 100644 src/Behat/Behat/Context/Argument/ArgumentResolverFactory.php
create mode 100644 src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php
diff --git a/src/Behat/Behat/Context/Argument/ArgumentResolverFactory.php b/src/Behat/Behat/Context/Argument/ArgumentResolverFactory.php
new file mode 100644
index 000000000..708c38bc7
--- /dev/null
+++ b/src/Behat/Behat/Context/Argument/ArgumentResolverFactory.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\Context\Argument;
+
+use Behat\Testwork\Environment\Environment;
+
+/**
+ * Creates argument resolvers for provided environment.
+ *
+ * @see ContextEnvironmentHandler
+ *
+ * @author Konstantin Kudryashov
+ */
+interface ArgumentResolverFactory
+{
+ /**
+ * Builds argument resolvers for provided suite.
+ *
+ * @param Environment $environment
+ *
+ * @return ArgumentResolver[]
+ */
+ public function createArgumentResolvers(Environment $environment);
+}
diff --git a/src/Behat/Behat/Context/Argument/NullFactory.php b/src/Behat/Behat/Context/Argument/NullFactory.php
index 6265cc4c2..c2e070c40 100644
--- a/src/Behat/Behat/Context/Argument/NullFactory.php
+++ b/src/Behat/Behat/Context/Argument/NullFactory.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\Context\Argument;
+use Behat\Testwork\Environment\Environment;
use Behat\Testwork\Suite\Suite;
/**
@@ -19,7 +20,7 @@
*
* @author Konstantin Kudryashov
*/
-final class NullFactory implements SuiteScopedResolverFactory
+final class NullFactory implements ArgumentResolverFactory, SuiteScopedResolverFactory
{
/**
* {@inheritdoc}
@@ -28,4 +29,12 @@ public function generateArgumentResolvers(Suite $suite)
{
return array();
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createArgumentResolvers(Environment $environment)
+ {
+ return array();
+ }
}
diff --git a/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php b/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php
index 60d858826..9f953fc2d 100644
--- a/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php
+++ b/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php
@@ -18,6 +18,8 @@
* @see ContextEnvironmentHandler
*
* @author Konstantin Kudryashov
+ *
+ * @deprecated since 3.4. Use `ArgumentResolverFactory` instead
*/
interface SuiteScopedResolverFactory
{
diff --git a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
index d5c3a0fce..0b9b9b127 100644
--- a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
+++ b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
@@ -10,10 +10,12 @@
namespace Behat\Behat\Context\Environment\Handler;
+use Behat\Behat\Context\Argument\ArgumentResolver;
use Behat\Behat\Context\Argument\SuiteScopedResolverFactory;
use Behat\Behat\Context\Argument\NullFactory;
use Behat\Behat\Context\ContextClass\ClassResolver;
use Behat\Behat\Context\ContextFactory;
+use Behat\Behat\Context\Environment\ContextEnvironment;
use Behat\Behat\Context\Environment\InitializedContextEnvironment;
use Behat\Behat\Context\Environment\UninitializedContextEnvironment;
use Behat\Testwork\Environment\Environment;
@@ -36,7 +38,7 @@ final class ContextEnvironmentHandler implements EnvironmentHandler
*/
private $contextFactory;
/**
- * @var SuiteScopedResolverFactory
+ * @var ArgumentResolver|SuiteScopedResolverFactory
*/
private $resolverFactory;
/**
@@ -47,10 +49,10 @@ final class ContextEnvironmentHandler implements EnvironmentHandler
/**
* Initializes handler.
*
- * @param ContextFactory $factory
- * @param SuiteScopedResolverFactory $resolverFactory
+ * @param ContextFactory $factory
+ * @param ArgumentResolver|SuiteScopedResolverFactory $resolverFactory
*/
- public function __construct(ContextFactory $factory, SuiteScopedResolverFactory $resolverFactory = null)
+ public function __construct(ContextFactory $factory, $resolverFactory = null)
{
$this->contextFactory = $factory;
$this->resolverFactory = $resolverFactory ?: new NullFactory();
@@ -108,7 +110,7 @@ public function isolateEnvironment(Environment $uninitializedEnvironment, $testS
}
$environment = new InitializedContextEnvironment($uninitializedEnvironment->getSuite());
- $resolvers = $this->resolverFactory->generateArgumentResolvers($uninitializedEnvironment->getSuite());
+ $resolvers = $this->createArgumentResolvers($environment);
foreach ($uninitializedEnvironment->getContextClassesWithArguments() as $class => $arguments) {
$context = $this->contextFactory->createContext($class, $arguments, $resolvers);
@@ -184,4 +186,22 @@ private function resolveClass($class)
return $class;
}
+
+ /**
+ * Creates argument resolvers for a given environment.
+ *
+ * @param ContextEnvironment $environment
+ *
+ * @return ArgumentResolver[]
+ */
+ private function createArgumentResolvers(ContextEnvironment $environment)
+ {
+ if ($this->resolverFactory instanceof ArgumentResolver) {
+ return $this->resolverFactory->createArgumentResolvers($environment);
+ } elseif ($this->resolverFactory instanceof SuiteScopedResolverFactory) {
+ return $this->resolverFactory->generateArgumentResolvers($environment->getSuite());
+ }
+
+ return array();
+ }
}
diff --git a/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php b/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
index c26826ecf..d03e6df1b 100644
--- a/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
+++ b/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
@@ -15,6 +15,7 @@
use Behat\Behat\Context\Exception\ContextNotFoundException;
use Behat\Testwork\Call\Callee;
use Behat\Testwork\Suite\Suite;
+use Psr\Container\ContainerInterface;
/**
* Context environment based on a list of instantiated context objects.
@@ -23,12 +24,16 @@
*
* @author Konstantin Kudryashov
*/
-final class InitializedContextEnvironment implements ContextEnvironment
+final class InitializedContextEnvironment implements ContextEnvironment, ServiceContainerEnvironment
{
/**
* @var string
*/
private $suite;
+ /**
+ * @var ContainerInterface
+ */
+ private $serviceContainer;
/**
* @var Context[]
*/
@@ -54,6 +59,14 @@ public function registerContext(Context $context)
$this->contexts[get_class($context)] = $context;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function setServiceContainer(ContainerInterface $container = null)
+ {
+ $this->serviceContainer = $container;
+ }
+
/**
* {@inheritdoc}
*/
@@ -117,6 +130,14 @@ public function getContext($class)
return $this->contexts[$class];
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getServiceContainer()
+ {
+ return $this->serviceContainer;
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php b/src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php
new file mode 100644
index 000000000..cc72bb7c1
--- /dev/null
+++ b/src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\Context\Environment;
+
+use Behat\Testwork\Environment\Environment;
+use Psr\Container\ContainerInterface;
+
+/**
+ * Represents test environment based on a service locator pattern.
+ *
+ * @see ContextEnvironmentHandler
+ *
+ * @author Konstantin Kudryashov
+ */
+interface ServiceContainerEnvironment extends Environment
+{
+ /**
+ * Sets/unsets service container for the environment.
+ *
+ * @param ContainerInterface|null $container
+ */
+ public function setServiceContainer(ContainerInterface $container = null);
+
+ /**
+ * Returns environment service container if set.
+ *
+ * @return null|ContainerInterface
+ */
+ public function getServiceContainer();
+}
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index 25617033f..a95d14d5a 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -10,11 +10,14 @@
namespace Behat\Behat\HelperContainer\Argument;
+use Behat\Behat\Context\Environment\ServiceContainerEnvironment;
+use Behat\Behat\Context\Argument\ArgumentResolverFactory;
use Behat\Behat\Context\Argument\SuiteScopedResolverFactory;
use Behat\Behat\HelperContainer\BuiltInServiceContainer;
use Behat\Behat\HelperContainer\Exception\WrongContainerClassException;
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension;
+use Behat\Testwork\Environment\Environment;
use Behat\Testwork\Suite\Suite;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
@@ -26,7 +29,7 @@
*
* @author Konstantin Kudryashov
*/
-final class ServicesResolverFactory implements SuiteScopedResolverFactory
+final class ServicesResolverFactory implements SuiteScopedResolverFactory, ArgumentResolverFactory
{
/**
* @var TaggedContainerInterface
@@ -45,6 +48,8 @@ public function __construct(TaggedContainerInterface $container)
/**
* {@inheritdoc}
+ *
+ * @deprecated
*/
public function generateArgumentResolvers(Suite $suite)
{
@@ -57,6 +62,24 @@ public function generateArgumentResolvers(Suite $suite)
return array($this->createArgumentResolver($container));
}
+ /**
+ * {@inheritdoc}
+ */
+ public function createArgumentResolvers(Environment $environment)
+ {
+ if (!$environment->getSuite()->hasSetting('services')) {
+ return array();
+ }
+
+ $container = $this->createContainer($environment->getSuite()->getSetting('services'));
+
+ if ($environment instanceof ServiceContainerEnvironment) {
+ $environment->setServiceContainer($container);
+ }
+
+ return array($this->createArgumentResolver($container));
+ }
+
/**
* Creates container from the setting passed.
*
From 1168d1b9e7587c18321756b2e684f5deb36f1f60 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 13:35:54 +0100
Subject: [PATCH 072/567] Refactor towards SuiteScopedResolverFactoryAdapter
---
.../SuiteScopedResolverFactoryAdapter.php | 48 +++++++++++++++++++
.../Handler/ContextEnvironmentHandler.php | 42 +++++++---------
2 files changed, 66 insertions(+), 24 deletions(-)
create mode 100644 src/Behat/Behat/Context/Argument/SuiteScopedResolverFactoryAdapter.php
diff --git a/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactoryAdapter.php b/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactoryAdapter.php
new file mode 100644
index 000000000..2317c8eb6
--- /dev/null
+++ b/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactoryAdapter.php
@@ -0,0 +1,48 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\Context\Argument;
+
+use Behat\Testwork\Environment\Environment;
+
+/**
+ * Adapts SuiteScopedResolverFactory to new ArgumentResolverFactory interface.
+ *
+ * @see ContextEnvironmentHandler
+ *
+ * @author Konstantin Kudryashov
+ *
+ * @deprecated since 3.4. Use `ArgumentResolverFactory` instead
+ */
+final class SuiteScopedResolverFactoryAdapter implements ArgumentResolverFactory
+{
+ /**
+ * @var SuiteScopedResolverFactory
+ */
+ private $factory;
+
+ /**
+ * Initialises adapter.
+ *
+ * @param SuiteScopedResolverFactory $factory
+ */
+ public function __construct(SuiteScopedResolverFactory $factory)
+ {
+ $this->factory = $factory;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createArgumentResolvers(Environment $environment)
+ {
+ return $this->factory->generateArgumentResolvers($environment->getSuite());
+ }
+}
diff --git a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
index 0b9b9b127..7b8098233 100644
--- a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
+++ b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
@@ -10,12 +10,12 @@
namespace Behat\Behat\Context\Environment\Handler;
-use Behat\Behat\Context\Argument\ArgumentResolver;
use Behat\Behat\Context\Argument\SuiteScopedResolverFactory;
+use Behat\Behat\Context\Argument\SuiteScopedResolverFactoryAdapter;
+use Behat\Behat\Context\Argument\ArgumentResolverFactory;
use Behat\Behat\Context\Argument\NullFactory;
use Behat\Behat\Context\ContextClass\ClassResolver;
use Behat\Behat\Context\ContextFactory;
-use Behat\Behat\Context\Environment\ContextEnvironment;
use Behat\Behat\Context\Environment\InitializedContextEnvironment;
use Behat\Behat\Context\Environment\UninitializedContextEnvironment;
use Behat\Testwork\Environment\Environment;
@@ -23,6 +23,7 @@
use Behat\Testwork\Environment\Handler\EnvironmentHandler;
use Behat\Testwork\Suite\Exception\SuiteConfigurationException;
use Behat\Testwork\Suite\Suite;
+use Webmozart\Assert\Assert;
/**
* Handles build and initialisation of the context-based environments.
@@ -38,7 +39,7 @@ final class ContextEnvironmentHandler implements EnvironmentHandler
*/
private $contextFactory;
/**
- * @var ArgumentResolver|SuiteScopedResolverFactory
+ * @var ArgumentResolverFactory
*/
private $resolverFactory;
/**
@@ -49,12 +50,23 @@ final class ContextEnvironmentHandler implements EnvironmentHandler
/**
* Initializes handler.
*
- * @param ContextFactory $factory
- * @param ArgumentResolver|SuiteScopedResolverFactory $resolverFactory
+ * @param ContextFactory $factory
+ * @param ArgumentResolverFactory|SuiteScopedResolverFactory $resolverFactory
*/
public function __construct(ContextFactory $factory, $resolverFactory = null)
{
$this->contextFactory = $factory;
+
+ if ($resolverFactory && !$resolverFactory instanceof ArgumentResolverFactory) {
+ Assert::isInstanceOf(
+ $resolverFactory,
+ 'Behat\Behat\Context\Argument\SuiteScopedResolverFactory',
+ 'Argument resolver must implement ArgumentResolverFactory or SuiteScopedResolverFactory (deprecated)'
+ );
+
+ $resolverFactory = new SuiteScopedResolverFactoryAdapter($resolverFactory);
+ }
+
$this->resolverFactory = $resolverFactory ?: new NullFactory();
}
@@ -110,7 +122,7 @@ public function isolateEnvironment(Environment $uninitializedEnvironment, $testS
}
$environment = new InitializedContextEnvironment($uninitializedEnvironment->getSuite());
- $resolvers = $this->createArgumentResolvers($environment);
+ $resolvers = $this->resolverFactory->createArgumentResolvers($environment);
foreach ($uninitializedEnvironment->getContextClassesWithArguments() as $class => $arguments) {
$context = $this->contextFactory->createContext($class, $arguments, $resolvers);
@@ -186,22 +198,4 @@ private function resolveClass($class)
return $class;
}
-
- /**
- * Creates argument resolvers for a given environment.
- *
- * @param ContextEnvironment $environment
- *
- * @return ArgumentResolver[]
- */
- private function createArgumentResolvers(ContextEnvironment $environment)
- {
- if ($this->resolverFactory instanceof ArgumentResolver) {
- return $this->resolverFactory->createArgumentResolvers($environment);
- } elseif ($this->resolverFactory instanceof SuiteScopedResolverFactory) {
- return $this->resolverFactory->generateArgumentResolvers($environment->getSuite());
- }
-
- return array();
- }
}
From eea03496d0b1a2d14de8c8b808a8e9831a8bbf4a Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 13:38:39 +0100
Subject: [PATCH 073/567] Trigger deprecation warning
---
.../HelperContainer/Argument/ServicesResolverFactory.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index a95d14d5a..c6520e887 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -49,10 +49,15 @@ public function __construct(TaggedContainerInterface $container)
/**
* {@inheritdoc}
*
- * @deprecated
+ * @deprecated as part of SuiteScopedResolverFactory deprecation. Would be removed in 4.0
*/
public function generateArgumentResolvers(Suite $suite)
{
+ @trigger_error(
+ 'SuiteScopedResolverFactory::generateArgumentResolvers() was deprecated and will be removed in 4.0',
+ E_USER_DEPRECATED
+ );
+
if (!$suite->hasSetting('services')) {
return array();
}
From 8b699c58973f082e6537125c19bd11b12d11b920 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 13:53:50 +0100
Subject: [PATCH 074/567] Remove Assert
---
.../Environment/Handler/ContextEnvironmentHandler.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
index 7b8098233..d686400dd 100644
--- a/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
+++ b/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php
@@ -23,7 +23,6 @@
use Behat\Testwork\Environment\Handler\EnvironmentHandler;
use Behat\Testwork\Suite\Exception\SuiteConfigurationException;
use Behat\Testwork\Suite\Suite;
-use Webmozart\Assert\Assert;
/**
* Handles build and initialisation of the context-based environments.
@@ -58,12 +57,6 @@ public function __construct(ContextFactory $factory, $resolverFactory = null)
$this->contextFactory = $factory;
if ($resolverFactory && !$resolverFactory instanceof ArgumentResolverFactory) {
- Assert::isInstanceOf(
- $resolverFactory,
- 'Behat\Behat\Context\Argument\SuiteScopedResolverFactory',
- 'Argument resolver must implement ArgumentResolverFactory or SuiteScopedResolverFactory (deprecated)'
- );
-
$resolverFactory = new SuiteScopedResolverFactoryAdapter($resolverFactory);
}
From 74c665dcc28e18a34142032ddfcc5fd8333d74c8 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 3 Sep 2017 11:07:19 +0100
Subject: [PATCH 075/567] Fix release building
---
.travis.yml | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c33d5edad..7477ba96d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,12 +52,9 @@ before_deploy:
deploy:
provider: releases
- api_key:
- secure: KLoJVMKTdabtNxRxVk92Lx9+ifK6nyYx2ATRflvaxJLJ0tkbvdkYwFnd79JuarE2FlJ65/Jd2Buy+dXCRPUkEaQ5Mg5IeZQg9C9qjTCjPE46n1nFa9487b/ZWsmx/iE7Bh8D2+A5CiEC62EXxWxf2i41IKaCr6t2ws49EjGOp+0=
+ api_key: $GITHUB_API_KEY
file: behat.phar
skip_cleanup: true
on:
- repo: Behat/Behat
tags: true
- php: 5.6
- condition: $SYMFONY_VERSION == "2.8.*"
+ php: 5.4
From 421e60098a81290d17a2092332b298133afbc7e6 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 15:29:35 +0100
Subject: [PATCH 076/567] Initial pass at services autowiring
---
features/autowire.feature | 162 ++++++++++++++++++
.../CompositeArgumentResolverFactory.php | 52 ++++++
.../Context/Argument/CompositeFactory.php | 2 +
.../ServiceContainer/ContextExtension.php | 2 +-
.../Argument/ServicesResolver.php | 24 ++-
.../Argument/ServicesResolverFactory.php | 16 +-
.../Call/Filter/ServicesResolver.php | 90 ++++++++++
.../Exception/UnsupportedCallException.php | 50 ++++++
.../HelperContainerExtension.php | 5 +
9 files changed, 394 insertions(+), 9 deletions(-)
create mode 100644 features/autowire.feature
create mode 100644 src/Behat/Behat/Context/Argument/CompositeArgumentResolverFactory.php
create mode 100644 src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
create mode 100644 src/Behat/Behat/HelperContainer/Exception/UnsupportedCallException.php
diff --git a/features/autowire.feature b/features/autowire.feature
new file mode 100644
index 000000000..8470eeb36
--- /dev/null
+++ b/features/autowire.feature
@@ -0,0 +1,162 @@
+Feature: Helper services autowire
+ In order to speed up the development process at early stages
+ developers need to have a convenient way of requesting services without going through the explicit configuration layer
+
+ Rules:
+ - Autowiring only works with helper containers
+ - Autowiring is off by default
+ - Autowiring is enabled/disabled by a suite-level `autowire` flag
+ - It works for context constructor arguments
+ - It works for step definition arguments
+ - It works for transformation arguments
+ - It only wires arguments that weren't otherwise set
+
+ Background:
+ Given a file named "behat.yaml" with:
+ """
+ default:
+ suites:
+ default:
+ services: ServiceContainer
+ autowire: true
+ """
+ And a file named "features/bootstrap/ServiceContainer.php" with:
+ """
+ services[$class])
+ ? $this->services[$class]
+ : $this->services[$class] = new $class;
+ }
+ }
+ """
+
+ Scenario: Constructor arguments
+ Given a file named "features/autowire.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given a step
+ """
+ And a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ state = $value;
+ }
+
+ /** @Then that state should be persisted as :value */
+ public function checkState($val, Service2 $s2) {
+ PHPUnit_Framework_Assert::assertEquals($val, $s2->state);
+ }
+ }
+ """
+ When I run "behat --no-colors -f progress features/autowire.feature"
+ Then it should pass
+
+ Scenario: Transformation arguments
+ Given a file named "features/autowire.feature" with:
+ """
+ Feature:
+ Scenario:
+ When I set the "myFlag" flag to "isSet"
+ Then the "myFlag" flag should be persisted as "isSet"
+ """
+ And a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ $flag;
+ }
+
+ /** @When I set the :flat flag to :value */
+ public function setState($flag, $value, Service2 $s2) {
+ $s2->$flag = $value;
+ }
+
+ /** @Then the :flag flag should be persisted as :value */
+ public function checkState($flag, $value) {
+ PHPUnit_Framework_Assert::assertEquals($value, $flag);
+ }
+ }
+ """
+ When I run "behat --no-colors -f progress features/autowire.feature"
+ Then it should pass
diff --git a/src/Behat/Behat/Context/Argument/CompositeArgumentResolverFactory.php b/src/Behat/Behat/Context/Argument/CompositeArgumentResolverFactory.php
new file mode 100644
index 000000000..fbfd69c83
--- /dev/null
+++ b/src/Behat/Behat/Context/Argument/CompositeArgumentResolverFactory.php
@@ -0,0 +1,52 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\Context\Argument;
+
+use Behat\Testwork\Environment\Environment;
+
+/**
+ * Composite factory. Delegates to other (registered) factories to do the job.
+ *
+ * @see ContextEnvironmentHandler
+ *
+ * @author Konstantin Kudryashov
+ */
+final class CompositeArgumentResolverFactory implements ArgumentResolverFactory
+{
+ /**
+ * @var ArgumentResolverFactory[]
+ */
+ private $factories = array();
+
+ /**
+ * Registers factory.
+ *
+ * @param ArgumentResolverFactory $factory
+ */
+ public function registerFactory(ArgumentResolverFactory $factory)
+ {
+ $this->factories[] = $factory;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createArgumentResolvers(Environment $environment)
+ {
+ return array_reduce(
+ $this->factories,
+ function (array $resolvers, ArgumentResolverFactory $factory) use ($environment) {
+ return array_merge($resolvers, $factory->createArgumentResolvers($environment));
+ },
+ array()
+ );
+ }
+}
diff --git a/src/Behat/Behat/Context/Argument/CompositeFactory.php b/src/Behat/Behat/Context/Argument/CompositeFactory.php
index 822896c8a..5b3d93f84 100644
--- a/src/Behat/Behat/Context/Argument/CompositeFactory.php
+++ b/src/Behat/Behat/Context/Argument/CompositeFactory.php
@@ -18,6 +18,8 @@
* @see ContextEnvironmentHandler
*
* @author Konstantin Kudryashov
+ *
+ * @deprecated and will be removed in 4.0. Use CompositeArgumentResolverFactory instead
*/
final class CompositeFactory implements SuiteScopedResolverFactory
{
diff --git a/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php
index de3f35248..f4c6917b7 100644
--- a/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php
+++ b/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php
@@ -142,7 +142,7 @@ private function loadFactory(ContainerBuilder $container)
*/
private function loadArgumentResolverFactory(ContainerBuilder $container)
{
- $definition = new Definition('Behat\Behat\Context\Argument\CompositeFactory');
+ $definition = new Definition('Behat\Behat\Context\Argument\CompositeArgumentResolverFactory');
$container->setDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID, $definition);
}
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
index 1031a0587..6052e1ca4 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
@@ -27,15 +27,21 @@ final class ServicesResolver implements ArgumentResolver
* @var ContainerInterface
*/
private $container;
+ /**
+ * @var bool
+ */
+ private $autowire;
/**
* Initialises resolver.
*
* @param ContainerInterface $container
+ * @param bool $autowire
*/
- public function __construct(ContainerInterface $container)
+ public function __construct(ContainerInterface $container, $autowire = false)
{
$this->container = $container;
+ $this->autowire = $autowire;
}
/**
@@ -43,7 +49,21 @@ public function __construct(ContainerInterface $container)
*/
public function resolveArguments(ReflectionClass $classReflection, array $arguments)
{
- return array_map(array($this, 'resolveArgument'), $arguments);
+ $newArguments = array_map(array($this, 'resolveArgument'), $arguments);
+
+ if ($this->autowire && $classReflection->getConstructor()) {
+ foreach ($classReflection->getConstructor()->getParameters() as $index => $parameter) {
+ if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
+ continue;
+ }
+
+ if ($parameter->hasType() && $this->container->has($parameter->getType()->getName())) {
+ $newArguments[$index] = $this->container->get($parameter->getType()->getName());
+ }
+ }
+ }
+
+ return $newArguments;
}
/**
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index c6520e887..07bc7d2d7 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -64,7 +64,7 @@ public function generateArgumentResolvers(Suite $suite)
$container = $this->createContainer($suite->getSetting('services'));
- return array($this->createArgumentResolver($container));
+ return array($this->createArgumentResolver($container, false));
}
/**
@@ -72,17 +72,20 @@ public function generateArgumentResolvers(Suite $suite)
*/
public function createArgumentResolvers(Environment $environment)
{
- if (!$environment->getSuite()->hasSetting('services')) {
+ $suite = $environment->getSuite();
+
+ if (!$suite->hasSetting('services')) {
return array();
}
- $container = $this->createContainer($environment->getSuite()->getSetting('services'));
+ $container = $this->createContainer($suite->getSetting('services'));
+ $autowire = $suite->hasSetting('autowire') && $suite->getSetting('autowire');
if ($environment instanceof ServiceContainerEnvironment) {
$environment->setServiceContainer($container);
}
- return array($this->createArgumentResolver($container));
+ return array($this->createArgumentResolver($container, $autowire));
}
/**
@@ -177,10 +180,11 @@ private function createContainerFromClassSpec($classSpec)
* Checks if container implements the correct interface and creates resolver using it.
*
* @param mixed $container
+ * @param bool $autowire
*
* @return ServicesResolver
*/
- private function createArgumentResolver($container)
+ private function createArgumentResolver($container, $autowire)
{
if (!$container instanceof ContainerInterface) {
throw new WrongContainerClassException(
@@ -192,6 +196,6 @@ private function createArgumentResolver($container)
);
}
- return new ServicesResolver($container);
+ return new ServicesResolver($container, $autowire);
}
}
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
new file mode 100644
index 000000000..368dcb673
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -0,0 +1,90 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer\Call\Filter;
+
+use Behat\Behat\Context\Environment\ServiceContainerEnvironment;
+use Behat\Behat\Definition\Call\DefinitionCall;
+use Behat\Behat\HelperContainer\Exception\UnsupportedCallException;
+use Behat\Behat\Transformation\Call\TransformationCall;
+use Behat\Testwork\Call\Call;
+use Behat\Testwork\Call\Filter\CallFilter;
+use Behat\Testwork\Environment\Call\EnvironmentCall;
+
+/**
+ * Dynamically resolves call arguments using the service container.
+ *
+ * @author Konstantin Kudryashov
+ */
+final class ServicesResolver implements CallFilter
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsCall(Call $call)
+ {
+ return ($call instanceof DefinitionCall || $call instanceof TransformationCall)
+ && $call->getEnvironment() instanceof ServiceContainerEnvironment;
+ }
+
+ /**
+ * Filters a call and returns a new one.
+ *
+ * @param Call $call
+ *
+ * @return Call
+ */
+ public function filterCall(Call $call)
+ {
+ if (!$call instanceof EnvironmentCall || !$call->getEnvironment() instanceof ServiceContainerEnvironment) {
+ throw new UnsupportedCallException(sprintf(
+ 'ServicesResolver can not filter `%s` call.',
+ get_class($call)
+ ), $call);
+ }
+
+ $container = $call->getEnvironment()->getServiceContainer();
+ $newArguments = $call->getArguments();
+
+ if ($container) {
+ foreach ($call->getCallee()->getReflection()->getParameters() as $index => $parameter) {
+ if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
+ continue;
+ }
+
+ if ($parameter->hasType() && $container->has((string) $parameter->getType())) {
+ $newArguments[$index] = $container->get((string) $parameter->getType());
+ }
+ }
+ }
+
+ if ($call instanceof DefinitionCall) {
+ return new DefinitionCall(
+ $call->getEnvironment(),
+ $call->getFeature(),
+ $call->getStep(),
+ $call->getCallee(),
+ $newArguments,
+ $call->getErrorReportingLevel()
+ );
+ }
+
+ if ($call instanceof TransformationCall) {
+ return new TransformationCall(
+ $call->getEnvironment(),
+ $call->getDefinition(),
+ $call->getCallee(),
+ $newArguments
+ );
+ }
+
+ return $call;
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Exception/UnsupportedCallException.php b/src/Behat/Behat/HelperContainer/Exception/UnsupportedCallException.php
new file mode 100644
index 000000000..7f16ca82f
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/Exception/UnsupportedCallException.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer\Exception;
+
+use Behat\Testwork\Call\Call;
+use InvalidArgumentException;
+
+/**
+ * Represents an exception caused by an attempt to filter an unsupported call.
+ *
+ * @author Konstantin Kudryashov
+ */
+final class UnsupportedCallException extends InvalidArgumentException implements HelperContainerException
+{
+ /**
+ * @var Call
+ */
+ private $call;
+
+ /**
+ * Initializes exception.
+ *
+ * @param string $message
+ * @param Call $call
+ */
+ public function __construct($message, Call $call)
+ {
+ parent::__construct($message);
+
+ $this->call = $call;
+ }
+
+ /**
+ * Returns a call that caused exception.
+ *
+ * @return Call
+ */
+ public function getCall()
+ {
+ return $this->call;
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php b/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
index 09ff59400..1d5100f5c 100644
--- a/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
+++ b/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
@@ -12,6 +12,7 @@
use Behat\Behat\Context\ServiceContainer\ContextExtension;
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
+use Behat\Testwork\Call\ServiceContainer\CallExtension;
use Behat\Testwork\ServiceContainer\Extension;
use Behat\Testwork\ServiceContainer\ExtensionManager;
use Behat\Testwork\ServiceContainer\ServiceProcessor;
@@ -78,6 +79,10 @@ public function load(ContainerBuilder $container, array $config)
$definition = new Definition('Behat\Behat\HelperContainer\Argument\ServicesResolverFactory', array($container));
$definition->addTag(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG, array('priority' => 0));
$container->setDefinition(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG . '.helper_container', $definition);
+
+ $definition = new Definition('Behat\Behat\HelperContainer\Call\Filter\ServicesResolver');
+ $definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 0));
+ $container->setDefinition(CallExtension::CALL_FILTER_TAG . '.helper_container', $definition);
}
/**
From 31974c10a908c92aeef9244739f712a795f61772 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 16:39:30 +0100
Subject: [PATCH 077/567] Use php5-compatible reflection API
---
src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php | 4 ++--
.../Behat/HelperContainer/Call/Filter/ServicesResolver.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
index 6052e1ca4..57ea55fe2 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
@@ -57,8 +57,8 @@ public function resolveArguments(ReflectionClass $classReflection, array $argume
continue;
}
- if ($parameter->hasType() && $this->container->has($parameter->getType()->getName())) {
- $newArguments[$index] = $this->container->get($parameter->getType()->getName());
+ if ($parameter->getClass() && $this->container->has($parameter->getClass()->getName())) {
+ $newArguments[$index] = $this->container->get($parameter->getClass()->getName());
}
}
}
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index 368dcb673..3c150a076 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -59,8 +59,8 @@ public function filterCall(Call $call)
continue;
}
- if ($parameter->hasType() && $container->has((string) $parameter->getType())) {
- $newArguments[$index] = $container->get((string) $parameter->getType());
+ if ($parameter->getClass() && $container->has($parameter->getClass()->getName())) {
+ $newArguments[$index] = $container->get($parameter->getClass()->getName());
}
}
}
From 894a0835d8ce978965766404765bc616d953713e Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 16:40:05 +0100
Subject: [PATCH 078/567] Fix scenario title
---
features/autowire.feature | 2 --
1 file changed, 2 deletions(-)
diff --git a/features/autowire.feature b/features/autowire.feature
index 8470eeb36..589228796 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -101,8 +101,6 @@ Feature: Helper services autowire
Then it should pass
Scenario: Step definition arguments
-
- Scenario: Constructor arguments
Given a file named "features/autowire.feature" with:
"""
Feature:
From b69dce1c617ef7c8109a4a212051af639899ffe4 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 17:00:00 +0100
Subject: [PATCH 079/567] Refactoring and handling of negative cases
---
features/autowire.feature | 59 +++++++++++-
.../Argument/ServicesResolver.php | 37 +++++--
.../Call/Filter/ServicesResolver.php | 96 ++++++++++++++-----
3 files changed, 160 insertions(+), 32 deletions(-)
diff --git a/features/autowire.feature b/features/autowire.feature
index 589228796..700579a2b 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -17,8 +17,8 @@ Feature: Helper services autowire
default:
suites:
default:
- services: ServiceContainer
autowire: true
+ services: ServiceContainer
"""
And a file named "features/bootstrap/ServiceContainer.php" with:
"""
@@ -27,6 +27,7 @@ Feature: Helper services autowire
class Service1 {public $state;}
class Service2 {public $state;}
class Service3 {public $state;}
+ class Service4 {public $state;}
class ServiceContainer implements ContainerInterface {
private $services = array();
@@ -36,6 +37,9 @@ Feature: Helper services autowire
}
public function get($class) {
+ if (!$this->has($class))
+ throw new \Behat\Behat\HelperContainer\Exception\ServiceNotFoundException("Service $class not found", $class);
+
return isset($this->services[$class])
? $this->services[$class]
: $this->services[$class] = new $class;
@@ -100,6 +104,31 @@ Feature: Helper services autowire
When I run "behat --no-colors -f progress features/autowire.feature"
Then it should pass
+ Scenario: Unregistered services as constructor arguments
+ Given a file named "features/autowire.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given a step
+ """
+ And a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ autowire && $classReflection->getConstructor()) {
- foreach ($classReflection->getConstructor()->getParameters() as $index => $parameter) {
- if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
- continue;
- }
+ $constructor = $classReflection->getConstructor();
- if ($parameter->getClass() && $this->container->has($parameter->getClass()->getName())) {
- $newArguments[$index] = $this->container->get($parameter->getClass()->getName());
- }
- }
+ if ($this->autowire && $constructor) {
+ return $this->autowireArguments($constructor, $newArguments);
}
return $newArguments;
@@ -84,4 +79,28 @@ private function resolveArgument($value)
return $value;
}
+
+ /**
+ * Autowires given arguments.
+ *
+ * @param ReflectionFunctionAbstract $constructor
+ * @param array $arguments
+ *
+ * @return array
+ */
+ private function autowireArguments(ReflectionFunctionAbstract $constructor, array $arguments)
+ {
+ $newArguments = $arguments;
+ foreach ($constructor->getParameters() as $index => $parameter) {
+ if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()]) || !$parameter->getClass()) {
+ continue;
+ }
+
+ if ($parameter->getClass()) {
+ $newArguments[$index] = $this->container->get($parameter->getClass()->getName());
+ }
+ }
+
+ return $newArguments;
+ }
}
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index 3c150a076..d3aedf086 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -17,6 +17,8 @@
use Behat\Testwork\Call\Call;
use Behat\Testwork\Call\Filter\CallFilter;
use Behat\Testwork\Environment\Call\EnvironmentCall;
+use Psr\Container\ContainerInterface;
+use ReflectionFunctionAbstract;
/**
* Dynamically resolves call arguments using the service container.
@@ -43,48 +45,98 @@ public function supportsCall(Call $call)
*/
public function filterCall(Call $call)
{
- if (!$call instanceof EnvironmentCall || !$call->getEnvironment() instanceof ServiceContainerEnvironment) {
+ if ($container = $this->getContainer($call)) {
+ $newArguments = $this->autowireArguments(
+ $container,
+ $call->getCallee()->getReflection(),
+ $call->getArguments()
+ );
+
+ return $this->repackageCallWithNewArguments($call, $newArguments);
+ }
+
+ return $call;
+ }
+
+ /**
+ * Gets container from the call.
+ *
+ * @param Call $call
+ *
+ * @return null|ContainerInterface
+ */
+ private function getContainer(Call $call)
+ {
+ if (!$call instanceof EnvironmentCall) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
- $container = $call->getEnvironment()->getServiceContainer();
- $newArguments = $call->getArguments();
+ if (!$call->getEnvironment() instanceof ServiceContainerEnvironment) {
+ throw new UnsupportedCallException(sprintf(
+ 'ServicesResolver can not filter `%s` call.',
+ get_class($call)
+ ), $call);
+ }
- if ($container) {
- foreach ($call->getCallee()->getReflection()->getParameters() as $index => $parameter) {
- if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
- continue;
- }
+ return $call->getEnvironment()->getServiceContainer();
+ }
- if ($parameter->getClass() && $container->has($parameter->getClass()->getName())) {
- $newArguments[$index] = $container->get($parameter->getClass()->getName());
- }
+ /**
+ * * Autowires given arguments using provided container.
+ *
+ * @param ContainerInterface $container
+ * @param ReflectionFunctionAbstract $reflection
+ * @param array $arguments
+ *
+ * @return array
+ */
+ private function autowireArguments(
+ ContainerInterface $container,
+ ReflectionFunctionAbstract $reflection,
+ array $arguments
+ ) {
+ $newArguments = $arguments;
+ foreach ($reflection->getParameters() as $index => $parameter) {
+ if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
+ continue;
+ }
+
+ if ($parameter->getClass()) {
+ $newArguments[$index] = $container->get($parameter->getClass()->getName());
}
}
+ return $newArguments;
+ }
+ /**
+ * Repackages old calls with new arguments.
+ *
+ * @param Call $call
+ * @param array $arguments
+ *
+ * @return DefinitionCall|TransformationCall
+ */
+ private function repackageCallWithNewArguments(Call $call, array $arguments)
+ {
if ($call instanceof DefinitionCall) {
return new DefinitionCall(
$call->getEnvironment(),
$call->getFeature(),
$call->getStep(),
$call->getCallee(),
- $newArguments,
+ $arguments,
$call->getErrorReportingLevel()
);
}
- if ($call instanceof TransformationCall) {
- return new TransformationCall(
- $call->getEnvironment(),
- $call->getDefinition(),
- $call->getCallee(),
- $newArguments
- );
- }
-
- return $call;
+ return new TransformationCall(
+ $call->getEnvironment(),
+ $call->getDefinition(),
+ $call->getCallee(),
+ $arguments
+ );
}
}
From e86e7ed6492ec2d92ecb874bcc8a2dc779a7d2db Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 17:02:20 +0100
Subject: [PATCH 080/567] Improve readability of
ServicesResolver::repackageCallWithNewArguments
---
.../Behat/HelperContainer/Call/Filter/ServicesResolver.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index d3aedf086..7cf69dd84 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -114,12 +114,12 @@ private function autowireArguments(
/**
* Repackages old calls with new arguments.
*
- * @param Call $call
- * @param array $arguments
+ * @param DefinitionCall|TransformationCall $call
+ * @param array $arguments
*
* @return DefinitionCall|TransformationCall
*/
- private function repackageCallWithNewArguments(Call $call, array $arguments)
+ private function repackageCallWithNewArguments($call, array $arguments)
{
if ($call instanceof DefinitionCall) {
return new DefinitionCall(
From 3cf8b0804b0b4c389dea661f75c3e6efc343a585 Mon Sep 17 00:00:00 2001
From: everzet
Date: Fri, 1 Sep 2017 17:05:30 +0100
Subject: [PATCH 081/567] Services must be last arguments
---
features/autowire.feature | 2 ++
1 file changed, 2 insertions(+)
diff --git a/features/autowire.feature b/features/autowire.feature
index 700579a2b..41441af8e 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -10,6 +10,8 @@ Feature: Helper services autowire
- It works for step definition arguments
- It works for transformation arguments
- It only wires arguments that weren't otherwise set
+ - Services must be last arguments in step definitions
+ - Services must be last arguments in transformations
Background:
Given a file named "behat.yaml" with:
From 7b4bb60b2708b96efeb0d5720fb60be09f411311 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 09:36:30 +0100
Subject: [PATCH 082/567] Refactor ..\Call\..\ServicesResolver
---
.../InitializedContextEnvironment.php | 1 +
.../Argument/ServicesResolverFactory.php | 2 +-
.../HelperContainer/ArgumentAutowirer.php | 74 +++++++++++++++++
.../Call/Filter/ServicesResolver.php | 81 ++++++++-----------
.../ServiceContainerEnvironment.php | 2 +-
5 files changed, 112 insertions(+), 48 deletions(-)
create mode 100644 src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
rename src/Behat/Behat/{Context => HelperContainer}/Environment/ServiceContainerEnvironment.php (94%)
diff --git a/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php b/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
index d03e6df1b..053354963 100644
--- a/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
+++ b/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php
@@ -13,6 +13,7 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler;
use Behat\Behat\Context\Exception\ContextNotFoundException;
+use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment;
use Behat\Testwork\Call\Callee;
use Behat\Testwork\Suite\Suite;
use Psr\Container\ContainerInterface;
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index 07bc7d2d7..7c6c2855f 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -10,7 +10,7 @@
namespace Behat\Behat\HelperContainer\Argument;
-use Behat\Behat\Context\Environment\ServiceContainerEnvironment;
+use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment;
use Behat\Behat\Context\Argument\ArgumentResolverFactory;
use Behat\Behat\Context\Argument\SuiteScopedResolverFactory;
use Behat\Behat\HelperContainer\BuiltInServiceContainer;
diff --git a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
new file mode 100644
index 000000000..f16df4ad1
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
@@ -0,0 +1,74 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer;
+
+use Psr\Container\ContainerInterface;
+use ReflectionFunctionAbstract;
+use ReflectionParameter;
+
+/**
+ * Automatically wires arguments of a given function from inside the container by using type-hitns.
+ *
+ * @author Konstantin Kudryashov
+ */
+final class ArgumentAutowirer
+{
+ /**
+ * @var ContainerInterface
+ */
+ private $container;
+
+ /**
+ * Initialises wirer.
+ *
+ * @param ContainerInterface $container
+ */
+ public function __construct(ContainerInterface $container)
+ {
+ $this->container = $container;
+ }
+
+ /**
+ * * Autowires given arguments using provided container.
+ *
+ * @param ReflectionFunctionAbstract $reflection
+ * @param array $arguments
+ *
+ * @return array
+ */
+ public function autowireArguments(ReflectionFunctionAbstract $reflection, array $arguments)
+ {
+ $newArguments = $arguments;
+ foreach ($reflection->getParameters() as $index => $parameter) {
+ if ($this->isArgumentWireable($newArguments, $index, $parameter)) {
+ $newArguments[$index] = $this->container->get($parameter->getClass()->getName());
+ }
+ }
+
+ return $newArguments;
+ }
+
+ /**
+ * Checks if given argument is wireable.
+ *
+ * Argument is wireable if it was not previously set and it has a class type-hint.
+ *
+ * @param array $arguments
+ * @param integer $index
+ * @param ReflectionParameter $parameter
+ *
+ * @return bool
+ */
+ private function isArgumentWireable(array $arguments, $index, ReflectionParameter $parameter)
+ {
+ return !isset($arguments[$index]) && !isset($arguments[$parameter->getName()]) && $parameter->getClass();
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index 7cf69dd84..97a7991c7 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -10,15 +10,15 @@
namespace Behat\Behat\HelperContainer\Call\Filter;
-use Behat\Behat\Context\Environment\ServiceContainerEnvironment;
+use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment;
use Behat\Behat\Definition\Call\DefinitionCall;
+use Behat\Behat\HelperContainer\ArgumentAutowirer;
use Behat\Behat\HelperContainer\Exception\UnsupportedCallException;
use Behat\Behat\Transformation\Call\TransformationCall;
use Behat\Testwork\Call\Call;
use Behat\Testwork\Call\Filter\CallFilter;
use Behat\Testwork\Environment\Call\EnvironmentCall;
use Psr\Container\ContainerInterface;
-use ReflectionFunctionAbstract;
/**
* Dynamically resolves call arguments using the service container.
@@ -42,15 +42,14 @@ public function supportsCall(Call $call)
* @param Call $call
*
* @return Call
+ *
+ * @throws UnsupportedCallException
*/
public function filterCall(Call $call)
{
if ($container = $this->getContainer($call)) {
- $newArguments = $this->autowireArguments(
- $container,
- $call->getCallee()->getReflection(),
- $call->getArguments()
- );
+ $autowirer = new ArgumentAutowirer($container);
+ $newArguments = $autowirer->autowireArguments($call->getCallee()->getReflection(), $call->getArguments());
return $this->repackageCallWithNewArguments($call, $newArguments);
}
@@ -64,6 +63,8 @@ public function filterCall(Call $call)
* @param Call $call
*
* @return null|ContainerInterface
+ *
+ * @throws UnsupportedCallException if given call is not EnvironmentCall or environment is not ServiceContainerEnvironment
*/
private function getContainer(Call $call)
{
@@ -74,53 +75,34 @@ private function getContainer(Call $call)
), $call);
}
- if (!$call->getEnvironment() instanceof ServiceContainerEnvironment) {
+ $environment = $call->getEnvironment();
+
+ if (!$environment instanceof ServiceContainerEnvironment) {
throw new UnsupportedCallException(sprintf(
'ServicesResolver can not filter `%s` call.',
get_class($call)
), $call);
}
- return $call->getEnvironment()->getServiceContainer();
- }
-
- /**
- * * Autowires given arguments using provided container.
- *
- * @param ContainerInterface $container
- * @param ReflectionFunctionAbstract $reflection
- * @param array $arguments
- *
- * @return array
- */
- private function autowireArguments(
- ContainerInterface $container,
- ReflectionFunctionAbstract $reflection,
- array $arguments
- ) {
- $newArguments = $arguments;
- foreach ($reflection->getParameters() as $index => $parameter) {
- if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()])) {
- continue;
- }
-
- if ($parameter->getClass()) {
- $newArguments[$index] = $container->get($parameter->getClass()->getName());
- }
- }
- return $newArguments;
+ return $environment->getServiceContainer();
}
/**
* Repackages old calls with new arguments.
*
- * @param DefinitionCall|TransformationCall $call
- * @param array $arguments
+ * @param Call $call
+ * @param array $arguments
+ *
+ * @return Call
*
- * @return DefinitionCall|TransformationCall
+ * @throws UnsupportedCallException if given call is not DefinitionCall or TransformationCall
*/
- private function repackageCallWithNewArguments($call, array $arguments)
+ private function repackageCallWithNewArguments(Call $call, array $arguments)
{
+ if ($arguments === $call->getArguments()) {
+ return $call;
+ }
+
if ($call instanceof DefinitionCall) {
return new DefinitionCall(
$call->getEnvironment(),
@@ -132,11 +114,18 @@ private function repackageCallWithNewArguments($call, array $arguments)
);
}
- return new TransformationCall(
- $call->getEnvironment(),
- $call->getDefinition(),
- $call->getCallee(),
- $arguments
- );
+ if ($call instanceof TransformationCall) {
+ return new TransformationCall(
+ $call->getEnvironment(),
+ $call->getDefinition(),
+ $call->getCallee(),
+ $arguments
+ );
+ }
+
+ throw new UnsupportedCallException(sprintf(
+ 'ServicesResolver can not filter `%s` call.',
+ get_class($call)
+ ), $call);
}
}
diff --git a/src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php b/src/Behat/Behat/HelperContainer/Environment/ServiceContainerEnvironment.php
similarity index 94%
rename from src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php
rename to src/Behat/Behat/HelperContainer/Environment/ServiceContainerEnvironment.php
index cc72bb7c1..8f58ba623 100644
--- a/src/Behat/Behat/Context/Environment/ServiceContainerEnvironment.php
+++ b/src/Behat/Behat/HelperContainer/Environment/ServiceContainerEnvironment.php
@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
-namespace Behat\Behat\Context\Environment;
+namespace Behat\Behat\HelperContainer\Environment;
use Behat\Testwork\Environment\Environment;
use Psr\Container\ContainerInterface;
From f5629fa1bba3d30ba215b9abaa008a7b8ff592d2 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 09:50:59 +0100
Subject: [PATCH 083/567] Refactor ServicesResolverFactory
---
.../Argument/AutowiringResolver.php | 53 +++++++++++++++++++
.../Argument/ServicesResolver.php | 50 +++--------------
.../Argument/ServicesResolverFactory.php | 35 +++++++++---
3 files changed, 88 insertions(+), 50 deletions(-)
create mode 100644 src/Behat/Behat/HelperContainer/Argument/AutowiringResolver.php
diff --git a/src/Behat/Behat/HelperContainer/Argument/AutowiringResolver.php b/src/Behat/Behat/HelperContainer/Argument/AutowiringResolver.php
new file mode 100644
index 000000000..11dde13b9
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/Argument/AutowiringResolver.php
@@ -0,0 +1,53 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer\Argument;
+
+use Behat\Behat\Context\Argument\ArgumentResolver;
+use Behat\Behat\HelperContainer\ArgumentAutowirer;
+use Psr\Container\ContainerInterface;
+use ReflectionClass;
+
+/**
+ * Resolves arguments that weren't resolved before by autowiring.
+ *
+ * @see ContextFactory
+ *
+ * @author Konstantin Kudryashov
+ */
+final class AutowiringResolver implements ArgumentResolver
+{
+ /**
+ * @var ArgumentAutowirer
+ */
+ private $autowirer;
+
+ /**
+ * Initialises resolver.
+ *
+ * @param ContainerInterface $container
+ */
+ public function __construct(ContainerInterface $container)
+ {
+ $this->autowirer = new ArgumentAutowirer($container);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function resolveArguments(ReflectionClass $classReflection, array $arguments)
+ {
+ if ($constructor = $classReflection->getConstructor()) {
+ return $this->autowirer->autowireArguments($constructor, $arguments);
+ }
+
+ return $arguments;
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
index 6539302cd..9e16f32de 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
@@ -11,9 +11,9 @@
namespace Behat\Behat\HelperContainer\Argument;
use Behat\Behat\Context\Argument\ArgumentResolver;
+use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use ReflectionClass;
-use ReflectionFunctionAbstract;
/**
* Resolves arguments using provided service container.
@@ -28,37 +28,25 @@ final class ServicesResolver implements ArgumentResolver
* @var ContainerInterface
*/
private $container;
- /**
- * @var bool
- */
- private $autowire;
/**
* Initialises resolver.
*
* @param ContainerInterface $container
- * @param bool $autowire
*/
- public function __construct(ContainerInterface $container, $autowire = false)
+ public function __construct(ContainerInterface $container)
{
$this->container = $container;
- $this->autowire = $autowire;
}
/**
* {@inheritdoc}
+ *
+ * @throws ContainerExceptionInterface
*/
public function resolveArguments(ReflectionClass $classReflection, array $arguments)
{
- $newArguments = array_map(array($this, 'resolveArgument'), $arguments);
-
- $constructor = $classReflection->getConstructor();
-
- if ($this->autowire && $constructor) {
- return $this->autowireArguments($constructor, $newArguments);
- }
-
- return $newArguments;
+ return array_map(array($this, 'resolveArgument'), $arguments);
}
/**
@@ -70,37 +58,15 @@ public function resolveArguments(ReflectionClass $classReflection, array $argume
* @param mixed $value
*
* @return mixed
+ *
+ * @throws ContainerExceptionInterface
*/
private function resolveArgument($value)
{
- if ('@' === mb_substr($value, 0, 1)) {
+ if (0 === mb_strpos($value, '@')) {
return $this->container->get(mb_substr($value, 1));
}
return $value;
}
-
- /**
- * Autowires given arguments.
- *
- * @param ReflectionFunctionAbstract $constructor
- * @param array $arguments
- *
- * @return array
- */
- private function autowireArguments(ReflectionFunctionAbstract $constructor, array $arguments)
- {
- $newArguments = $arguments;
- foreach ($constructor->getParameters() as $index => $parameter) {
- if (isset($newArguments[$index]) || isset($newArguments[$parameter->getName()]) || !$parameter->getClass()) {
- continue;
- }
-
- if ($parameter->getClass()) {
- $newArguments[$index] = $this->container->get($parameter->getClass()->getName());
- }
- }
-
- return $newArguments;
- }
}
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
index 7c6c2855f..8820288c5 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\HelperContainer\Argument;
+use Behat\Behat\Context\Argument\ArgumentResolver;
use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment;
use Behat\Behat\Context\Argument\ArgumentResolverFactory;
use Behat\Behat\Context\Argument\SuiteScopedResolverFactory;
@@ -50,6 +51,9 @@ public function __construct(TaggedContainerInterface $container)
* {@inheritdoc}
*
* @deprecated as part of SuiteScopedResolverFactory deprecation. Would be removed in 4.0
+ *
+ * @throws WrongServicesConfigurationException
+ * @throws WrongContainerClassException
*/
public function generateArgumentResolvers(Suite $suite)
{
@@ -64,11 +68,14 @@ public function generateArgumentResolvers(Suite $suite)
$container = $this->createContainer($suite->getSetting('services'));
- return array($this->createArgumentResolver($container, false));
+ return $this->createResolvers($container, false);
}
/**
* {@inheritdoc}
+ *
+ * @throws WrongServicesConfigurationException
+ * @throws WrongContainerClassException
*/
public function createArgumentResolvers(Environment $environment)
{
@@ -85,7 +92,7 @@ public function createArgumentResolvers(Environment $environment)
$environment->setServiceContainer($container);
}
- return array($this->createArgumentResolver($container, $autowire));
+ return $this->createResolvers($container, $autowire);
}
/**
@@ -94,6 +101,8 @@ public function createArgumentResolvers(Environment $environment)
* @param string $settings
*
* @return mixed
+ *
+ * @throws WrongServicesConfigurationException
*/
private function createContainer($settings)
{
@@ -116,10 +125,12 @@ private function createContainer($settings)
* @param string $settings
*
* @return mixed
+ *
+ * @throws WrongServicesConfigurationException
*/
private function createContainerFromString($settings)
{
- if ('@' === mb_substr($settings, 0, 1)) {
+ if (0 === mb_strpos($settings, '@')) {
return $this->loadContainerFromContainer(mb_substr($settings, 1));
}
@@ -144,12 +155,14 @@ private function createContainerFromArray(array $settings)
* @param string $name
*
* @return mixed
+ *
+ * @throws WrongServicesConfigurationException
*/
private function loadContainerFromContainer($name)
{
$services = $this->container->findTaggedServiceIds(HelperContainerExtension::HELPER_CONTAINER_TAG);
- if (!in_array($name, array_keys($services))) {
+ if (!array_key_exists($name, $services)) {
throw new WrongServicesConfigurationException(
sprintf('Service container `@%s` was not found.', $name)
);
@@ -169,7 +182,7 @@ private function createContainerFromClassSpec($classSpec)
{
$constructor = explode('::', $classSpec);
- if (2 == count($constructor)) {
+ if (2 === count($constructor)) {
return call_user_func($constructor);
}
@@ -182,9 +195,11 @@ private function createContainerFromClassSpec($classSpec)
* @param mixed $container
* @param bool $autowire
*
- * @return ServicesResolver
+ * @return ArgumentResolver[]
+ *
+ * @throws WrongContainerClassException
*/
- private function createArgumentResolver($container, $autowire)
+ private function createResolvers($container, $autowire)
{
if (!$container instanceof ContainerInterface) {
throw new WrongContainerClassException(
@@ -196,6 +211,10 @@ private function createArgumentResolver($container, $autowire)
);
}
- return new ServicesResolver($container, $autowire);
+ if ($autowire) {
+ return array(new ServicesResolver($container), new AutowiringResolver($container));
+ }
+
+ return array(new ServicesResolver($container));
}
}
From 102d141b0458aaf13169b7e141869f7d0d07e947 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 09:52:51 +0100
Subject: [PATCH 084/567] Simplify expectation
---
features/autowire.feature | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/features/autowire.feature b/features/autowire.feature
index 41441af8e..6e8c9285f 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -127,8 +127,7 @@ Feature: Helper services autowire
When I run "behat --no-colors -f progress features/autowire.feature"
Then it should fail with:
"""
- [Behat\Behat\HelperContainer\Exception\ServiceNotFoundException]
- Service Service4 not found
+ Service Service4 not found
"""
Scenario: Step definition arguments
@@ -177,13 +176,7 @@ Feature: Helper services autowire
When I run "behat --no-colors -f progress features/autowire.feature"
Then it should fail with:
"""
- F
-
- --- Failed steps:
-
- 001 Scenario: # features/autowire.feature:2
- Given a step # features/autowire.feature:3
- Fatal error: Service Service4 not found (Behat\Testwork\Call\Exception\FatalThrowableError)
+ Service Service4 not found
"""
Scenario: Transformation arguments
From 6fd2d24c3cc77f7f11b6da90354310f3e5776316 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 09:56:50 +0100
Subject: [PATCH 085/567] Fix docblock
---
src/Behat/Behat/HelperContainer/ArgumentAutowirer.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
index f16df4ad1..d4d514728 100644
--- a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
+++ b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\HelperContainer;
+use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use ReflectionFunctionAbstract;
use ReflectionParameter;
@@ -37,12 +38,14 @@ public function __construct(ContainerInterface $container)
}
/**
- * * Autowires given arguments using provided container.
+ * Autowires given arguments using provided container.
*
* @param ReflectionFunctionAbstract $reflection
- * @param array $arguments
+ * @param array $arguments
*
* @return array
+ *
+ * @throws ContainerExceptionInterface if unset argument typehint can not be resolved from container
*/
public function autowireArguments(ReflectionFunctionAbstract $reflection, array $arguments)
{
From e33d10bf03e89abea2f0f958cdb0f312a3b0e778 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 10:00:41 +0100
Subject: [PATCH 086/567] Simplify Call ServicesResolver a bit
---
.../Call/Filter/ServicesResolver.php | 33 +++++++++++++++----
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index 97a7991c7..a214b6465 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -18,6 +18,7 @@
use Behat\Testwork\Call\Call;
use Behat\Testwork\Call\Filter\CallFilter;
use Behat\Testwork\Environment\Call\EnvironmentCall;
+use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
/**
@@ -44,6 +45,7 @@ public function supportsCall(Call $call)
* @return Call
*
* @throws UnsupportedCallException
+ * @throws ContainerExceptionInterface
*/
public function filterCall(Call $call)
{
@@ -51,7 +53,7 @@ public function filterCall(Call $call)
$autowirer = new ArgumentAutowirer($container);
$newArguments = $autowirer->autowireArguments($call->getCallee()->getReflection(), $call->getArguments());
- return $this->repackageCallWithNewArguments($call, $newArguments);
+ return $this->repackageCallIfNewArguments($call, $newArguments);
}
return $call;
@@ -88,7 +90,7 @@ private function getContainer(Call $call)
}
/**
- * Repackages old calls with new arguments.
+ * Repackages old calls with new arguments, but only if two differ.
*
* @param Call $call
* @param array $arguments
@@ -97,12 +99,27 @@ private function getContainer(Call $call)
*
* @throws UnsupportedCallException if given call is not DefinitionCall or TransformationCall
*/
- private function repackageCallWithNewArguments(Call $call, array $arguments)
+ private function repackageCallIfNewArguments(Call $call, array $arguments)
{
if ($arguments === $call->getArguments()) {
return $call;
}
+ return $this->repackageCallWithNewArguments($call, $arguments);
+ }
+
+ /**
+ * Repackages old calls with new arguments.
+ *
+ * @param Call $call
+ * @param array $arguments
+ *
+ * @return DefinitionCall|TransformationCall
+ *
+ * @throws UnsupportedCallException
+ */
+ private function repackageCallWithNewArguments(Call $call, array $arguments)
+ {
if ($call instanceof DefinitionCall) {
return new DefinitionCall(
$call->getEnvironment(),
@@ -123,9 +140,11 @@ private function repackageCallWithNewArguments(Call $call, array $arguments)
);
}
- throw new UnsupportedCallException(sprintf(
- 'ServicesResolver can not filter `%s` call.',
- get_class($call)
- ), $call);
+ throw new UnsupportedCallException(
+ sprintf(
+ 'ServicesResolver can not filter `%s` call.',
+ get_class($call)
+ ), $call
+ );
}
}
From 7c9970438af4d87547b4484f0fbff5e1ea324207 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 10:36:16 +0100
Subject: [PATCH 087/567] Implement simple notation for inline services
---
features/helper_containers.feature | 38 +++++++++++++++++++
.../BuiltInServiceContainer.php | 10 ++++-
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 934a6bbf9..4b77d321f 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -250,6 +250,44 @@ Feature: Per-suite helper containers
When I run "behat --no-colors -f progress features/container.feature"
Then it should pass
+ Scenario: Built-in container with class names as service IDs
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - "@SharedService"
+ - SecondContext:
+ - "@SharedService"
+
+ services:
+ SharedService: ~
+ """
+ When I run "behat --no-colors -f progress features/container.feature"
+ Then it should pass
+
+ Scenario: Built-in container with class names as service IDs and arguments
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - "@SharedServiceExpecting1"
+ - SecondContext:
+ - "@SharedServiceExpecting1"
+
+ services:
+ SharedServiceExpecting1:
+ arguments:
+ - 1
+ """
+ When I run "behat --no-colors -f progress features/container.feature"
+ Then it should pass
+
Scenario: Built-in container with factory-based services
Given a file named "behat.yml" with:
"""
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index 71795ee84..c58bae65b 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -47,7 +47,7 @@ public function __construct(array $schema)
*/
public function has($id)
{
- return isset($this->schema[$id]);
+ return array_key_exists($id, $this->schema);
}
/**
@@ -99,6 +99,14 @@ private function getAndValidateServiceSchema($id)
{
$schema = $this->schema[$id];
+ if (null === $schema) {
+ $schema = array('class' => $id);
+ }
+
+ if (!isset($schema['class'])) {
+ $schema['class'] = $id;
+ }
+
if (is_string($schema)) {
$schema = array('class' => $schema);
}
From dc0bb881cedf8ef99ad926415a094342918f2936 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 10:47:11 +0100
Subject: [PATCH 088/567] Add couple guards
Likely unnecessary
---
.../Call/Filter/ServicesResolver.php | 86 +++++++++++++++----
1 file changed, 70 insertions(+), 16 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
index a214b6465..0c70fef71 100644
--- a/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Call/Filter/ServicesResolver.php
@@ -10,11 +10,13 @@
namespace Behat\Behat\HelperContainer\Call\Filter;
+use Behat\Behat\Definition\Definition;
use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment;
use Behat\Behat\Definition\Call\DefinitionCall;
use Behat\Behat\HelperContainer\ArgumentAutowirer;
use Behat\Behat\HelperContainer\Exception\UnsupportedCallException;
use Behat\Behat\Transformation\Call\TransformationCall;
+use Behat\Behat\Transformation\Transformation;
use Behat\Testwork\Call\Call;
use Behat\Testwork\Call\Filter\CallFilter;
use Behat\Testwork\Environment\Call\EnvironmentCall;
@@ -112,32 +114,20 @@ private function repackageCallIfNewArguments(Call $call, array $arguments)
* Repackages old calls with new arguments.
*
* @param Call $call
- * @param array $arguments
+ * @param array $newArguments
*
* @return DefinitionCall|TransformationCall
*
* @throws UnsupportedCallException
*/
- private function repackageCallWithNewArguments(Call $call, array $arguments)
+ private function repackageCallWithNewArguments(Call $call, array $newArguments)
{
if ($call instanceof DefinitionCall) {
- return new DefinitionCall(
- $call->getEnvironment(),
- $call->getFeature(),
- $call->getStep(),
- $call->getCallee(),
- $arguments,
- $call->getErrorReportingLevel()
- );
+ return $this->repackageDefinitionCall($call, $newArguments);
}
if ($call instanceof TransformationCall) {
- return new TransformationCall(
- $call->getEnvironment(),
- $call->getDefinition(),
- $call->getCallee(),
- $arguments
- );
+ return $this->repackageTransformationCall($call, $newArguments);
}
throw new UnsupportedCallException(
@@ -147,4 +137,68 @@ private function repackageCallWithNewArguments(Call $call, array $arguments)
), $call
);
}
+
+ /**
+ * Repackages definition call with new arguments.
+ *
+ * @param DefinitionCall $call
+ * @param array $newArguments
+ *
+ * @return DefinitionCall
+ *
+ * @throws UnsupportedCallException
+ */
+ private function repackageDefinitionCall(DefinitionCall $call, array $newArguments)
+ {
+ $definition = $call->getCallee();
+
+ if (!$definition instanceof Definition) {
+ throw new UnsupportedCallException(
+ sprintf(
+ 'Something is wrong in callee associated with `%s` call.',
+ get_class($call)
+ ), $call
+ );
+ }
+
+ return new DefinitionCall(
+ $call->getEnvironment(),
+ $call->getFeature(),
+ $call->getStep(),
+ $definition,
+ $newArguments,
+ $call->getErrorReportingLevel()
+ );
+ }
+
+ /**
+ * Repackages transformation call with new arguments.
+ *
+ * @param TransformationCall $call
+ * @param array $newArguments
+ *
+ * @return TransformationCall
+ *
+ * @throws UnsupportedCallException
+ */
+ private function repackageTransformationCall(TransformationCall $call, array $newArguments)
+ {
+ $transformation = $call->getCallee();
+
+ if (!$transformation instanceof Transformation) {
+ throw new UnsupportedCallException(
+ sprintf(
+ 'Something is wrong in callee associated with `%s` call.',
+ get_class($call)
+ ), $call
+ );
+ }
+
+ return new TransformationCall(
+ $call->getEnvironment(),
+ $call->getDefinition(),
+ $transformation,
+ $newArguments
+ );
+ }
}
From 4752f27e319ed0044ae44634b1a1b293ce865103 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 10:50:31 +0100
Subject: [PATCH 089/567] Avoid operating on non-array
---
src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index c58bae65b..809d5f268 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -103,7 +103,7 @@ private function getAndValidateServiceSchema($id)
$schema = array('class' => $id);
}
- if (!isset($schema['class'])) {
+ if (is_array($schema) && !array_key_exists('class', $schema)) {
$schema['class'] = $id;
}
From 606683f8255d8785cda755ea5a88b7e0196bfe1d Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Sep 2017 10:58:06 +0100
Subject: [PATCH 090/567] Refactor BuiltInServiceContainer
---
.../Behat/HelperContainer/BuiltInServiceContainer.php | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index 809d5f268..624bd28e5 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -103,10 +103,6 @@ private function getAndValidateServiceSchema($id)
$schema = array('class' => $id);
}
- if (is_array($schema) && !array_key_exists('class', $schema)) {
- $schema['class'] = $id;
- }
-
if (is_string($schema)) {
$schema = array('class' => $schema);
}
@@ -128,10 +124,7 @@ private function getAndValidateServiceSchema($id)
private function getAndValidateClass($id, array $schema)
{
if (!isset($schema['class'])) {
- throw new WrongServicesConfigurationException(sprintf(
- 'All services of the built-in `services` must have `class` option set, but `%s` does not.',
- $id
- ));
+ $schema['class'] = $id;
}
return $schema['class'];
From dd8d3d711a93a3eca91b581c2ddf25c1751e83ab Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 3 Sep 2017 10:46:37 +0100
Subject: [PATCH 091/567] Update CHANGELOG
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5392af5b0..cdb73622a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
+ * [#1071](https://github.com/Behat/Behat/pull/1071): Services auto-wiring
* [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md)
support for helper containers.
* Support for modern PHPUnit.
From 2ea1381d400dcdbe6829a8b867c7bbf0ab1fabe6 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 10 Sep 2017 12:08:16 +0100
Subject: [PATCH 092/567] Cleanup Travis build matrix
- Remove HHVM
- Remove non-supported PHP versions
- Do not test against DEV dependencies
---
.travis.yml | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7477ba96d..924bf1e7c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: php
-php: [5.4, 5.5, 5.6, 7.0, 7.1, hhvm]
+php: [5.6, 7.0, 7.1]
sudo: false
@@ -14,25 +14,17 @@ branches:
matrix:
include:
- - php: 5.4
- env: DEPENDENCIES='low'
- php: 5.6
- env: SYMFONY_VERSION='2.3.*'
+ env: DEPENDENCIES='low'
- php: 5.6
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- - php: 7.1
- env: DEPENDENCIES='dev'
- allow_failures:
- - php: hhvm
- fast_finish: true
before_install:
- - if [[ ${TRAVIS_PHP_VERSION:0:4} != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
+ - phpenv config-rm xdebug.ini
before_script:
- - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
@@ -57,4 +49,4 @@ deploy:
skip_cleanup: true
on:
tags: true
- php: 5.4
+ php: 5.6
From b2f2ec75e2b25d48ed96411551aae5b118217567 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 10 Sep 2017 12:18:37 +0100
Subject: [PATCH 093/567] Note the build matrix update in CHANGELOG
[ci skip]
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cdb73622a..2d861e454 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
is a non-breaking change. If you depend heavily on `Interop`, upgrade to
`1.2`, which is still supported by helper containers. Aim to migrate to
`Psr` before Behat 4.0 shows up on horizon
+ * PHP versions prior to 5.6 and HHVM were dropped from CI build matrix. It
+ doesn't mean that we'll start using features of 5.6 yet, it just means we
+ don't get out of our way to support 5.3 and 5.4 anymore. In 4.0 support will
+ be completely dropped.
## [3.3.1] - 2017-05-15
### Added
From dcee0bfcdd79a2b67d91f18f726bc0ddd548852e Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 10 Sep 2017 12:19:04 +0100
Subject: [PATCH 094/567] Bump dev-version
---
src/Behat/Behat/ApplicationFactory.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index ced51d911..261094881 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -46,7 +46,7 @@
*/
final class ApplicationFactory extends BaseFactory
{
- const VERSION = '3.3-dev';
+ const VERSION = '3.4-dev';
/**
* {@inheritdoc}
@@ -122,7 +122,7 @@ protected function getConfigPath()
$configDir . 'behat.yaml.dist',
$configDir . 'behat.yml.dist',
);
-
+
foreach ($paths as $path) {
if (is_file($path)) {
return $path;
From a6aab8b439fbdb8880238af05639535a530dd3f8 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sun, 10 Sep 2017 12:20:37 +0100
Subject: [PATCH 095/567] Bump changelog version
---
CHANGELOG.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d861e454..2aa98c7fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+
+## [3.4.0] - 2017-09-10
### Added
* [#1071](https://github.com/Behat/Behat/pull/1071): Services auto-wiring
* [#1054](https://github.com/Behat/Behat/pull/1054): [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md)
@@ -856,7 +858,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.3.1...HEAD
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.0...HEAD
+[3.4.0]: https://github.com/Behat/Behat/compare/v3.3.1...v3.4.0
[3.3.1]: https://github.com/Behat/Behat/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/Behat/Behat/compare/v3.2.3...v3.3.0
[3.2.3]: https://github.com/Behat/Behat/compare/v3.2.2...v3.2.3
From 8ab237fe7ca886a909b81830ea309fe9de996914 Mon Sep 17 00:00:00 2001
From: Scott Moorhouse
Date: Wed, 13 Sep 2017 11:37:41 -0700
Subject: [PATCH 096/567] Removing short array syntax
---
src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
index 3f770aa72..c24ddce17 100644
--- a/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
+++ b/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php
@@ -225,7 +225,7 @@ private function loadDefaultLoaders(ContainerBuilder $container, $cachePath)
}
$definition->addMethodCall('setCache', array($cacheDefinition));
- $definition->addMethodCall('setBasePath', ['%paths.base%']);
+ $definition->addMethodCall('setBasePath', array('%paths.base%'));
$definition->addTag(self::LOADER_TAG, array('priority' => 50));
$container->setDefinition('gherkin.loader.gherkin_file', $definition);
}
From 356cdd9a556ad42b3d9188a92e886effd9abecff Mon Sep 17 00:00:00 2001
From: Scott Moorhouse
Date: Wed, 13 Sep 2017 11:57:40 -0700
Subject: [PATCH 097/567] Add changelog message
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2aa98c7fb..cc9fe0aba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * PHP 5.3 style cleanup.
## [3.4.0] - 2017-09-10
### Added
From 745a3a61df20301b0a1436b87289096848a166ed Mon Sep 17 00:00:00 2001
From: Konstantin Kudryashov
Date: Mon, 18 Sep 2017 08:04:33 +0100
Subject: [PATCH 098/567] Fix Windows build
---
appveyor.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index a1e451243..945deee67 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.1.8-nts-Win32-VC14-x86.zip
+ - PHP_DOWNLOAD_FILE: php-7.1.9-nts-Win32-VC14-x86.zip
branches:
only:
From 269777f1477b132031f048aa45620aef787d8425 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 18 Sep 2017 12:09:58 +0100
Subject: [PATCH 099/567] Bump changelog
---
CHANGELOG.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc9fe0aba..26c9c258c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+
+## [3.4.1] - 2017-09-18
### Fixed
* PHP 5.3 style cleanup.
@@ -860,7 +862,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.0...HEAD
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.1...HEAD
+[3.4.1]: https://github.com/Behat/Behat/compare/v3.4.0...v3.4.1
[3.4.0]: https://github.com/Behat/Behat/compare/v3.3.1...v3.4.0
[3.3.1]: https://github.com/Behat/Behat/compare/v3.3.0...v3.3.1
[3.3.0]: https://github.com/Behat/Behat/compare/v3.2.3...v3.3.0
From e906b9f2e91b26298bc46166bc0b9ca89cd72e78 Mon Sep 17 00:00:00 2001
From: Serhii Polishchuk
Date: Thu, 28 Sep 2017 18:18:59 +0300
Subject: [PATCH 100/567] Added changelog
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26c9c258c..b3eacc21a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Added
+ * [#1083](https://github.com/Behat/Behat/pull/1083): JUnit time attribute
## [3.4.1] - 2017-09-18
### Fixed
From 6e0e51f3ef1fd6368fb156420ed456f3e1601628 Mon Sep 17 00:00:00 2001
From: Serhii Polishchuk
Date: Mon, 2 Oct 2017 13:23:25 +0300
Subject: [PATCH 101/567] Fixed time
---
.../Output/Node/EventListener/JUnit/JUnitDurationListener.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
index f5cb3a59b..b36a96176 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
@@ -68,7 +68,7 @@ private function captureAfterScenarioEvent(AfterScenarioTested $event)
$timer = $this->scenarioTimerStore[$key];
if ($timer instanceof Timer) {
$timer->stop();
- $this->resultStore[$key] = $timer->getSeconds();
+ $this->resultStore[$key] = round($timer->getTime());
}
}
@@ -78,7 +78,7 @@ private function captureAfterFeatureEvent(AfterFeatureTested $event)
$timer = $this->featureTimerStore[$key];
if ($timer instanceof Timer) {
$timer->stop();
- $this->featureResultStore[$key] = $timer->getSeconds();
+ $this->featureResultStore[$key] = round($timer->getTime());
}
}
From 0ab45bb4351d3e0738c4e9beb4432c84f73cb080 Mon Sep 17 00:00:00 2001
From: Benjamin Doherty
Date: Mon, 2 Oct 2017 20:25:09 -0500
Subject: [PATCH 102/567] Add missing property.
---
.../Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
index 27eb86de7..a20b6ded5 100644
--- a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
@@ -48,6 +48,11 @@ final class JUnitScenarioPrinter
*/
private $outlineStepCount;
+ /**
+ * @var JUnitDurationListener
+ */
+ private $durationListener;
+
public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener, JUnitDurationListener $durationListener)
{
$this->resultConverter = $resultConverter;
From 91821a821a256aae4c0122ec6b175b59ec5a291f Mon Sep 17 00:00:00 2001
From: Benjamin Doherty
Date: Tue, 3 Oct 2017 00:43:14 -0500
Subject: [PATCH 103/567] Simplify listenEvent method.
Each listener method returns early if the event object
isn't the right type.
---
.../JUnit/JUnitDurationListener.php | 43 +++++++++++--------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
index b36a96176..2c7372103 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
@@ -23,21 +23,10 @@ final class JUnitDurationListener implements EventListener
/** @inheritdoc */
public function listenEvent(Formatter $formatter, Event $event, $eventName)
{
- if ($event instanceof BeforeScenarioTested) {
- $this->captureBeforeScenarioEvent($event);
- }
-
- if ($event instanceof BeforeFeatureTested) {
- $this->captureBeforeFeatureTested($event);
- }
-
- if ($event instanceof AfterScenarioTested) {
- $this->captureAfterScenarioEvent($event);
- }
-
- if ($event instanceof AfterFeatureTested) {
- $this->captureAfterFeatureEvent($event);
- }
+ $this->captureBeforeScenarioEvent($event);
+ $this->captureBeforeFeatureTested($event);
+ $this->captureAfterScenarioEvent($event);
+ $this->captureAfterFeatureEvent($event);
}
public function getDuration(ScenarioLikeInterface $scenario)
@@ -52,18 +41,30 @@ public function getFeatureDuration(FeatureNode $feature)
return array_key_exists($key, $this->featureResultStore) ? $this->featureResultStore[$key] : '';
}
- private function captureBeforeFeatureTested(BeforeFeatureTested $event)
+ private function captureBeforeFeatureTested(Event $event)
{
+ if (!$event instanceof BeforeFeatureTested) {
+ return;
+ }
+
$this->featureTimerStore[$this->getHash($event->getFeature())] = $this->startTimer();
}
- private function captureBeforeScenarioEvent(BeforeScenarioTested $event)
+ private function captureBeforeScenarioEvent(Event $event)
{
+ if (!$event instanceof BeforeScenarioTested) {
+ return;
+ }
+
$this->scenarioTimerStore[$this->getHash($event->getScenario())] = $this->startTimer();
}
- private function captureAfterScenarioEvent(AfterScenarioTested $event)
+ private function captureAfterScenarioEvent(Event $event)
{
+ if (!$event instanceof AfterScenarioTested) {
+ return;
+ }
+
$key = $this->getHash($event->getScenario());
$timer = $this->scenarioTimerStore[$key];
if ($timer instanceof Timer) {
@@ -72,8 +73,12 @@ private function captureAfterScenarioEvent(AfterScenarioTested $event)
}
}
- private function captureAfterFeatureEvent(AfterFeatureTested $event)
+ private function captureAfterFeatureEvent(Event $event)
{
+ if (!$event instanceof AfterFeatureTested) {
+ return;
+ }
+
$key = $this->getHash($event->getFeature());
$timer = $this->featureTimerStore[$key];
if ($timer instanceof Timer) {
From d50fb7abeeab9d110f66a9446eb26e1ecbf3abf1 Mon Sep 17 00:00:00 2001
From: Denis Brumann
Date: Tue, 24 Oct 2017 14:00:28 +0200
Subject: [PATCH 104/567] Update dependencies to allow Symfony 4.x-components.
---
.travis.yml | 2 ++
composer.json | 16 ++++++++--------
.../Cli/ServiceContainer/CliExtension.php | 1 +
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 924bf1e7c..0b0cc2102 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,8 @@ matrix:
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
+ - php: 7.1
+ env: SYMFONY_VERSION='4.0.*@dev'
before_install:
- phpenv config-rm xdebug.ini
diff --git a/composer.json b/composer.json
index b3dbd81f3..fb2bf3e8f 100644
--- a/composer.json
+++ b/composer.json
@@ -18,19 +18,19 @@
"ext-mbstring": "*",
"behat/gherkin": "^4.5.1",
"behat/transliterator": "^1.2",
- "symfony/console": "~2.5||~3.0",
- "symfony/config": "~2.3||~3.0",
- "symfony/dependency-injection": "~2.1||~3.0",
- "symfony/event-dispatcher": "~2.1||~3.0",
- "symfony/translation": "~2.3||~3.0",
- "symfony/yaml": "~2.1||~3.0",
- "symfony/class-loader": "~2.1||~3.0",
+ "symfony/console": "~2.5||~3.0||~4.0",
+ "symfony/config": "~2.3||~3.0||~4.0",
+ "symfony/dependency-injection": "~2.1||~3.0||~4.0",
+ "symfony/event-dispatcher": "~2.1||~3.0||~4.0",
+ "symfony/translation": "~2.3||~3.0||~4.0",
+ "symfony/yaml": "~2.1||~3.0||~4.0",
+ "symfony/class-loader": "~2.1||~3.0||~4.0",
"psr/container": "^1.0",
"container-interop/container-interop": "^1.2"
},
"require-dev": {
- "symfony/process": "~2.5|~3.0",
+ "symfony/process": "~2.5|~3.0|~4.0",
"phpunit/phpunit": "~4.5",
"herrera-io/box": "~1.6.1"
},
diff --git a/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php b/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
index 4b9fba847..497993cef 100644
--- a/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
+++ b/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
@@ -99,6 +99,7 @@ public function process(ContainerBuilder $container)
protected function loadCommand(ContainerBuilder $container)
{
$definition = new Definition('Behat\Testwork\Cli\Command', array('%cli.command.name%', array()));
+ $definition->setPublic(true);
$container->setDefinition(self::COMMAND_ID, $definition);
}
From 396c79c660f238d0e284dab1b335b282bc828865 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Fri, 27 Oct 2017 10:43:55 +0100
Subject: [PATCH 105/567] Allow to use the latest PHPUnit but keep
compatibility with legacy versions
---
composer.json | 2 +-
features/append_snippets.feature | 48 +++++++--------
features/arguments.feature | 8 +--
features/autowire.feature | 6 +-
features/bootstrap/FeatureContext.php | 31 +++++-----
features/config_inheritance.feature | 4 +-
features/context.feature | 8 +--
features/definitions_patterns.feature | 58 +++++++++----------
features/definitions_transformations.feature | 12 ++--
features/definitions_translations.feature | 16 ++---
features/error_reporting.feature | 4 +-
features/extensions.feature | 2 +-
features/format_options.feature | 8 +--
features/helper_containers.feature | 4 +-
features/hooks.feature | 2 +-
features/i18n.feature | 2 +-
features/junit_format.feature | 16 ++---
features/multiple_formats.feature | 8 +--
features/outlines.feature | 4 +-
features/parameters.feature | 2 +-
features/pretty_format.feature | 6 +-
features/profiles.feature | 2 +-
features/rerun.feature | 8 +--
features/rerun_with_multiple_suite.feature | 8 +--
features/result_types.feature | 4 +-
features/traits.feature | 2 +-
.../Subject/GroupedSubjectIteratorTest.php | 3 +-
27 files changed, 140 insertions(+), 138 deletions(-)
diff --git a/composer.json b/composer.json
index b3dbd81f3..7126d0db4 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"require-dev": {
"symfony/process": "~2.5|~3.0",
- "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit": "^4.8.36|^6.3",
"herrera-io/box": "~1.6.1"
},
diff --git a/features/append_snippets.feature b/features/append_snippets.feature
index 8eb9390ec..e1727bdb4 100644
--- a/features/append_snippets.feature
+++ b/features/append_snippets.feature
@@ -47,22 +47,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -162,22 +162,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -267,22 +267,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -332,22 +332,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -435,22 +435,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
@@ -500,22 +500,22 @@ Feature: Append snippets option
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- \PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ \PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- \PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- \PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- \PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ \PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ \PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
private function doSomethingUndefinedWith() {}
diff --git a/features/arguments.feature b/features/arguments.feature
index 6da60915a..161a18111 100644
--- a/features/arguments.feature
+++ b/features/arguments.feature
@@ -44,22 +44,22 @@ Feature: Step Arguments
* @Then /^it must be equals to string (\d+)$/
*/
public function itMustBeEqualsToString($number) {
- \PHPUnit_Framework_Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
+ \PHPUnit\Framework\Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
}
/**
* @Then /^it must be equals to table (\d+)$/
*/
public function itMustBeEqualsToTable($number) {
- \PHPUnit_Framework_Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
+ \PHPUnit\Framework\Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
}
/**
* @Given /^I have number2 = (?P\d+) and number1 = (?P\d+)$/
*/
public function iHaveNumberAndNumber($number1, $number2) {
- \PHPUnit_Framework_Assert::assertEquals(13, intval($number1));
- \PHPUnit_Framework_Assert::assertEquals(243, intval($number2));
+ \PHPUnit\Framework\Assert::assertEquals(13, intval($number1));
+ \PHPUnit\Framework\Assert::assertEquals(243, intval($number2));
}
}
"""
diff --git a/features/autowire.feature b/features/autowire.feature
index 6e8c9285f..86cff9a69 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -96,7 +96,7 @@ Feature: Helper services autowire
class FeatureContext implements Context {
public function __construct(Service2 $s2, $name, Service1 $s1, Service3 $s3)
{
- PHPUnit_Framework_Assert::assertEquals('Konstantin', $name);
+ PHPUnit\Framework\Assert::assertEquals('Konstantin', $name);
}
/** @Given a step */
@@ -150,7 +150,7 @@ Feature: Helper services autowire
/** @Then that state should be persisted as :value */
public function checkState($val, Service2 $s2) {
- PHPUnit_Framework_Assert::assertEquals($val, $s2->state);
+ PHPUnit\Framework\Assert::assertEquals($val, $s2->state);
}
}
"""
@@ -204,7 +204,7 @@ Feature: Helper services autowire
/** @Then the :flag flag should be persisted as :value */
public function checkState($flag, $value) {
- PHPUnit_Framework_Assert::assertEquals($value, $flag);
+ PHPUnit\Framework\Assert::assertEquals($value, $flag);
}
}
"""
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 629c6fc21..11905b956 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -10,6 +10,7 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
+use PHPUnit\Framework\Assert;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -119,12 +120,12 @@ class FeatureContext implements Context
$this->createFile($this->workingDir . '/' . $filename, $content);
}
- /**
- * Creates a noop feature in current workdir.
- *
- * @Given /^(?:there is )?a some feature scenarios/
- */
- public function aNoopFeature()
+ /**
+ * Creates a noop feature in current workdir.
+ *
+ * @Given /^(?:there is )?a some feature scenarios/
+ */
+ public function aNoopFeature()
{
$filename = 'features/bootstrap/FeatureContext.php';
$content = <<<'EOL'
@@ -156,7 +157,7 @@ public function iAmInThePath($path)
*/
public function fileShouldExist($path)
{
- PHPUnit_Framework_Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
+ Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
}
/**
@@ -258,7 +259,7 @@ public function itShouldPassWith($success, PyStringNode $text)
public function itShouldPassWithNoOutput($success)
{
$this->itShouldFail($success);
- PHPUnit_Framework_Assert::assertEmpty($this->getOutput());
+ Assert::assertEmpty($this->getOutput());
}
/**
@@ -272,7 +273,7 @@ public function itShouldPassWithNoOutput($success)
public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- PHPUnit_Framework_Assert::assertFileExists($path);
+ Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
@@ -280,7 +281,7 @@ public function fileShouldContain($path, PyStringNode $text)
$fileContent = str_replace(PHP_EOL, "\n", $fileContent);
}
- PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
+ Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
}
/**
@@ -294,7 +295,7 @@ public function fileShouldContain($path, PyStringNode $text)
public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
- PHPUnit_Framework_Assert::assertFileExists($path);
+ Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
@@ -302,7 +303,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
$dom->loadXML($text);
$dom->formatOutput = true;
- PHPUnit_Framework_Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
+ Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
}
@@ -315,7 +316,7 @@ public function fileXmlShouldBeLike($path, PyStringNode $text)
*/
public function theOutputShouldContain(PyStringNode $text)
{
- PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
+ Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
}
private function getExpectedOutput(PyStringNode $expectedText)
@@ -363,13 +364,13 @@ public function itShouldFail($success)
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
+ Assert::assertNotEquals(0, $this->getExitCode());
} else {
if (0 !== $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
- PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
+ Assert::assertEquals(0, $this->getExitCode());
}
}
diff --git a/features/config_inheritance.feature b/features/config_inheritance.feature
index c418ad404..16d6cb5e6 100644
--- a/features/config_inheritance.feature
+++ b/features/config_inheritance.feature
@@ -73,12 +73,12 @@ Feature: Config inheritance
/** @Then the context parameters should be overwritten */
public function theContextParametersOverwrite() {
- \PHPUnit_Framework_Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
+ \PHPUnit\Framework\Assert::assertEquals(array('param2' => 'val2'), $this->parameters);
}
/** @Then the extension config should be merged */
public function theExtensionConfigMerge() {
- \PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
+ \PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val2', 'param2' => 'val1'), $this->extension);
}
}
"""
diff --git a/features/context.feature b/features/context.feature
index e96118009..eae21a44a 100644
--- a/features/context.feature
+++ b/features/context.feature
@@ -47,22 +47,22 @@ Feature: Context consistency
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
diff --git a/features/definitions_patterns.feature b/features/definitions_patterns.feature
index 66d4d553f..66eeb73d2 100644
--- a/features/definitions_patterns.feature
+++ b/features/definitions_patterns.feature
@@ -158,8 +158,8 @@ Feature: Step Definition Pattern
* @Given only second :second
*/
public function invalidRegex($first = 'foo', $second = 'fiz') {
- PHPUnit_Framework_Assert::assertEquals('foo', $first);
- PHPUnit_Framework_Assert::assertEquals('bar', $second);
+ PHPUnit\Framework\Assert::assertEquals('foo', $first);
+ PHPUnit\Framework\Assert::assertEquals('bar', $second);
}
}
"""
@@ -192,7 +192,7 @@ Feature: Step Definition Pattern
* @Given I can provide parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit_Framework_Assert::assertNull($param);
+ PHPUnit\Framework\Assert::assertNull($param);
}
}
"""
@@ -256,7 +256,7 @@ Feature: Step Definition Pattern
* parameter :param
*/
public function parameterCouldBeNull($param = null) {
- PHPUnit_Framework_Assert::assertNull($param);
+ PHPUnit\Framework\Assert::assertNull($param);
}
}
"""
@@ -295,8 +295,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $param2) {
- PHPUnit_Framework_Assert::assertEquals('one', $param1);
- PHPUnit_Framework_Assert::assertEquals('two', $param2);
+ PHPUnit\Framework\Assert::assertEquals('one', $param1);
+ PHPUnit\Framework\Assert::assertEquals('two', $param2);
}
}
"""
@@ -328,8 +328,8 @@ Feature: Step Definition Pattern
* @Given I can provide parameters :someParam and :someParam2
*/
public function multipleWrongNamedParameters($param1, $someParam) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $someParam);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $someParam);
}
}
"""
@@ -361,9 +361,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
- PHPUnit_Framework_Assert::assertEquals(2, $count);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
+ PHPUnit\Framework\Assert::assertEquals(2, $count);
}
}
"""
@@ -395,10 +395,10 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters :firstParam and :otherParam with:
*/
public function multipleWrongNamedParameters($param1, $firstParam, $count, $string) {
- PHPUnit_Framework_Assert::assertEquals('two', $param1);
- PHPUnit_Framework_Assert::assertEquals('one', $firstParam);
- PHPUnit_Framework_Assert::assertEquals(2, $count);
- PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
+ PHPUnit\Framework\Assert::assertEquals('two', $param1);
+ PHPUnit\Framework\Assert::assertEquals('one', $firstParam);
+ PHPUnit\Framework\Assert::assertEquals(2, $count);
+ PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -433,9 +433,9 @@ Feature: Step Definition Pattern
* @Given I can provide :count parameters for :name:
*/
public function multipleWrongNamedParameters($count, $name, $string) {
- PHPUnit_Framework_Assert::assertEquals('2', $count);
- PHPUnit_Framework_Assert::assertEquals('thing', $name);
- PHPUnit_Framework_Assert::assertEquals("Test", (string) $string);
+ PHPUnit\Framework\Assert::assertEquals('2', $count);
+ PHPUnit\Framework\Assert::assertEquals('thing', $name);
+ PHPUnit\Framework\Assert::assertEquals("Test", (string) $string);
}
}
"""
@@ -472,9 +472,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality($path = null, $isNegative = null, PyStringNode $json = null)
{
- PHPUnit_Framework_Assert::assertNull($path);
- PHPUnit_Framework_Assert::assertNull($isNegative);
- PHPUnit_Framework_Assert::assertNotNull($json);
+ PHPUnit\Framework\Assert::assertNull($path);
+ PHPUnit\Framework\Assert::assertNull($isNegative);
+ PHPUnit\Framework\Assert::assertNotNull($json);
}
/**
@@ -482,9 +482,9 @@ Feature: Step Definition Pattern
*/
public function checkEquality2($json = null, $path = null, $isNegative = null)
{
- PHPUnit_Framework_Assert::assertNull($path);
- PHPUnit_Framework_Assert::assertNull($isNegative);
- PHPUnit_Framework_Assert::assertNotNull($json);
+ PHPUnit\Framework\Assert::assertNull($path);
+ PHPUnit\Framework\Assert::assertNull($isNegative);
+ PHPUnit\Framework\Assert::assertNotNull($json);
}
}
"""
@@ -523,7 +523,7 @@ Feature: Step Definition Pattern
* @Given I have a package v:version
*/
public function multipleWrongNamedParameters($version) {
- PHPUnit_Framework_Assert::assertEquals('2.5', $version);
+ PHPUnit\Framework\Assert::assertEquals('2.5', $version);
}
}
"""
@@ -555,7 +555,7 @@ Feature: Step Definition Pattern
* @When I enter the string :input
*/
public function multipleWrongNamedParameters($input) {
- PHPUnit_Framework_Assert::assertEquals('', $input);
+ PHPUnit\Framework\Assert::assertEquals('', $input);
}
}
"""
@@ -587,8 +587,8 @@ Feature: Step Definition Pattern
* @Then images should be uploaded to web\/uploads\/media\/default\/:arg1\/:arg2\/
*/
public function multipleWrongNamedParameters($arg1, $arg2) {
- PHPUnit_Framework_Assert::assertEquals('0001', $arg1);
- PHPUnit_Framework_Assert::assertEquals('01', $arg2);
+ PHPUnit\Framework\Assert::assertEquals('0001', $arg1);
+ PHPUnit\Framework\Assert::assertEquals('01', $arg2);
}
}
"""
@@ -620,7 +620,7 @@ Feature: Step Definition Pattern
* @Given I have a negative number :num
*/
public function multipleWrongNamedParameters($num) {
- PHPUnit_Framework_Assert::assertEquals('-3', $num);
+ PHPUnit\Framework\Assert::assertEquals('-3', $num);
}
}
"""
diff --git a/features/definitions_transformations.feature b/features/definitions_transformations.feature
index ff986a4ce..92c4e6f25 100644
--- a/features/definitions_transformations.feature
+++ b/features/definitions_transformations.feature
@@ -117,29 +117,29 @@ Feature: Step Arguments Transformations
* @Then /Username must be "([^"]+)"/
*/
public function usernameMustBe($username) {
- PHPUnit_Framework_Assert::assertEquals($username, $this->user->getUsername());
+ PHPUnit\Framework\Assert::assertEquals($username, $this->user->getUsername());
}
/**
* @Then /Age must be (\d+)/
*/
public function ageMustBe($age) {
- PHPUnit_Framework_Assert::assertEquals($age, $this->user->getAge());
- PHPUnit_Framework_Assert::assertInternalType('int', $age);
+ PHPUnit\Framework\Assert::assertEquals($age, $this->user->getAge());
+ PHPUnit\Framework\Assert::assertInternalType('int', $age);
}
/**
* @Then the Usernames must be:
*/
public function usernamesMustBe(array $usernames) {
- PHPUnit_Framework_Assert::assertEquals($usernames[0], $this->user->getUsername());
+ PHPUnit\Framework\Assert::assertEquals($usernames[0], $this->user->getUsername());
}
/**
* @Then /^the boolean (no) should be transformed to false$/
*/
public function theBooleanShouldBeTransformed($boolean) {
- PHPUnit_Framework_Assert::assertSame(false, $boolean);
+ PHPUnit\Framework\Assert::assertSame(false, $boolean);
}
}
"""
@@ -289,7 +289,7 @@ Feature: Step Arguments Transformations
/** @Then the :field should be :value */
public function theFieldShouldBe($field, $value) {
- PHPUnit_Framework_Assert::assertSame($value, $this->data[0][$field]);
+ PHPUnit\Framework\Assert::assertSame($value, $this->data[0][$field]);
}
}
"""
diff --git a/features/definitions_translations.feature b/features/definitions_translations.feature
index df41e942f..c3ace9d05 100644
--- a/features/definitions_translations.feature
+++ b/features/definitions_translations.feature
@@ -47,7 +47,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -59,7 +59,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -150,7 +150,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -162,7 +162,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -231,7 +231,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -243,7 +243,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
@@ -321,7 +321,7 @@ Feature: Definitions translations
* @Then /^I should see (\d+) on the screen$/
*/
public function iShouldSeeOnTheScreen($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
/** @Transform /"([^"]+)" user/ */
@@ -333,7 +333,7 @@ Feature: Definitions translations
* @Then /^the ("[^"]+" user) name should be "([^"]*)"$/
*/
public function theUserUsername($user, $username) {
- PHPUnit_Framework_Assert::assertEquals($username, $user->name);
+ PHPUnit\Framework\Assert::assertEquals($username, $user->name);
}
public static function getTranslationResources() {
diff --git a/features/error_reporting.feature b/features/error_reporting.feature
index c3b859479..1139b48bc 100644
--- a/features/error_reporting.feature
+++ b/features/error_reporting.feature
@@ -37,7 +37,7 @@ Feature: Error Reporting
*/
public function iShouldGetNull()
{
- PHPUnit_Framework_Assert::assertNull($this->result);
+ PHPUnit\Framework\Assert::assertNull($this->result);
}
/**
@@ -53,7 +53,7 @@ Feature: Error Reporting
*/
public function iShouldGet($arg1)
{
- PHPUnit_Framework_Assert::assertEquals($arg1, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($arg1, $this->result);
}
}
diff --git a/features/extensions.feature b/features/extensions.feature
index 5fb9de911..9d5bd2f3f 100644
--- a/features/extensions.feature
+++ b/features/extensions.feature
@@ -31,7 +31,7 @@ Feature: Extensions
/** @Then the extension should be loaded */
public function theExtensionLoaded() {
- PHPUnit_Framework_Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
+ PHPUnit\Framework\Assert::assertEquals(array('param1' => 'val1', 'param2' => 'val2'), $this->extension);
}
}
"""
diff --git a/features/format_options.feature b/features/format_options.feature
index ce773fa0b..f523e42c9 100644
--- a/features/format_options.feature
+++ b/features/format_options.feature
@@ -47,22 +47,22 @@ Feature: Format options
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 4b77d321f..97032f256 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -47,7 +47,7 @@ Feature: Per-suite helper containers
/** @Given service has no state */
public function noState() {
- PHPUnit_Framework_Assert::assertNull($this->service->number);
+ PHPUnit\Framework\Assert::assertNull($this->service->number);
}
/** @When service gets a state of :number in first context */
@@ -67,7 +67,7 @@ Feature: Per-suite helper containers
/** @Then service should have a state of :number in second context */
public function checkState($number) {
- PHPUnit_Framework_Assert::assertSame($number, $this->service->number);
+ PHPUnit\Framework\Assert::assertSame($number, $this->service->number);
}
}
"""
diff --git a/features/hooks.feature b/features/hooks.feature
index 557969e4e..20066b000 100644
--- a/features/hooks.feature
+++ b/features/hooks.feature
@@ -101,7 +101,7 @@ Feature: hooks
* @Then /^I must have (\d+)$/
*/
public function iMustHave($number) {
- \PHPUnit_Framework_Assert::assertEquals(intval($number), $this->number);
+ \PHPUnit\Framework\Assert::assertEquals(intval($number), $this->number);
}
}
"""
diff --git a/features/i18n.feature b/features/i18n.feature
index b130b82e2..1856d204f 100644
--- a/features/i18n.feature
+++ b/features/i18n.feature
@@ -28,7 +28,7 @@ Feature: I18n
* @Then /Я должен иметь (\d+)/
*/
public function iShouldHave($number) {
- PHPUnit_Framework_Assert::assertEquals(intval($number), $this->value);
+ PHPUnit\Framework\Assert::assertEquals(intval($number), $this->value);
}
/**
diff --git a/features/junit_format.feature b/features/junit_format.feature
index f9e4bfd88..180cd5a27 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -26,7 +26,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -151,7 +151,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -223,7 +223,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -303,7 +303,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -333,7 +333,7 @@
* @Then /I will be stronger/
*/
public function iWillBeStronger() {
- PHPUnit_Framework_Assert::assertNotEquals(0, $this->strongLevel);
+ PHPUnit\Framework\Assert::assertNotEquals(0, $this->strongLevel);
}
}
"""
@@ -486,7 +486,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -550,7 +550,7 @@
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEqual($num, $this->value);
+ PHPUnit\Framework\Assert::assertEqual($num, $this->value);
}
/**
@@ -578,7 +578,7 @@
When I run "behat --no-colors -f junit -o junit"
Then it should fail with:
"""
- Call to undefined method PHPUnit_Framework_Assert::assertEqual
+ Call to undefined method PHPUnit\Framework\Assert::assertEqual
"""
And "junit/default.xml" file xml should be like:
"""
diff --git a/features/multiple_formats.feature b/features/multiple_formats.feature
index 1ef068178..ecbb2605c 100644
--- a/features/multiple_formats.feature
+++ b/features/multiple_formats.feature
@@ -47,22 +47,22 @@ Feature: Multiple formats
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/outlines.feature b/features/outlines.feature
index 148f9ab7c..352fca98c 100644
--- a/features/outlines.feature
+++ b/features/outlines.feature
@@ -80,7 +80,7 @@ Feature: Scenario Outlines
* @Then /^The result should be (\d+)$/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->result);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->result);
}
}
"""
@@ -242,7 +242,7 @@ Feature: Scenario Outlines
* @Then the result should be :result
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals(intval($result), $this->number);
+ PHPUnit\Framework\Assert::assertEquals(intval($result), $this->number);
}
}
"""
diff --git a/features/parameters.feature b/features/parameters.feature
index b60550dcc..784c542ac 100644
--- a/features/parameters.feature
+++ b/features/parameters.feature
@@ -53,7 +53,7 @@ Feature: Parameters
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals($result, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/pretty_format.feature b/features/pretty_format.feature
index 1bfa914ca..6f7a575ee 100644
--- a/features/pretty_format.feature
+++ b/features/pretty_format.feature
@@ -28,7 +28,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -163,7 +163,7 @@ Feature: Pretty Formatter
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals($num, $this->value);
+ PHPUnit\Framework\Assert::assertEquals($num, $this->value);
}
/**
@@ -245,7 +245,7 @@ Feature: Pretty Formatter
* @Then /I must have "([^"]+)"/
*/
public function iMustHave($num) {
- PHPUnit_Framework_Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
+ PHPUnit\Framework\Assert::assertEquals(intval(preg_replace('/[^\d]+/', '', $num)), $this->value);
}
/**
diff --git a/features/profiles.feature b/features/profiles.feature
index 481b3a9d6..6b726437b 100644
--- a/features/profiles.feature
+++ b/features/profiles.feature
@@ -51,7 +51,7 @@ Feature: Profiles
* @Then /The result should be (\d+)/
*/
public function theResultShouldBe($result) {
- PHPUnit_Framework_Assert::assertEquals($result, $this->result);
+ PHPUnit\Framework\Assert::assertEquals($result, $this->result);
}
}
"""
diff --git a/features/rerun.feature b/features/rerun.feature
index e835b8e0d..0aa3000c4 100644
--- a/features/rerun.feature
+++ b/features/rerun.feature
@@ -44,22 +44,22 @@ Feature: Rerun
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/rerun_with_multiple_suite.feature b/features/rerun_with_multiple_suite.feature
index feb04dfa4..a706b8d1e 100644
--- a/features/rerun_with_multiple_suite.feature
+++ b/features/rerun_with_multiple_suite.feature
@@ -60,22 +60,22 @@ Feature: Rerun with multiple suite
* @Then /^I should have (\d+) (apples|bananas)$/
*/
public function iShouldHaveFruit($count, $fruit) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->fruits[$fruit]);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->fruits[$fruit]);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
- PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
- PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
- PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->parameters[$key]);
+ PHPUnit\Framework\Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
diff --git a/features/result_types.feature b/features/result_types.feature
index 3467b6eaf..04feb95a5 100644
--- a/features/result_types.feature
+++ b/features/result_types.feature
@@ -236,7 +236,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit_Framework_Assert::assertEquals($money, $this->money);
+ PHPUnit\Framework\Assert::assertEquals($money, $this->money);
}
}
"""
@@ -324,7 +324,7 @@ Feature: Different result types
* @Then /^I should see (\d+)\$ on the screen$/
*/
public function iShouldSee($money) {
- PHPUnit_Framework_Assert::assertEquals($money, $this->money);
+ PHPUnit\Framework\Assert::assertEquals($money, $this->money);
}
}
"""
diff --git a/features/traits.feature b/features/traits.feature
index 0c2157cef..dc2c6a519 100644
--- a/features/traits.feature
+++ b/features/traits.feature
@@ -49,7 +49,7 @@ Feature: Support php 5.4 traits
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
- PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
+ PHPUnit\Framework\Assert::assertEquals(intval($count), $this->apples);
}
}
"""
diff --git a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
index e260b7596..84b8dd18f 100644
--- a/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
+++ b/tests/Behat/Tests/Testwork/Subject/GroupedSubjectIteratorTest.php
@@ -5,8 +5,9 @@
use Behat\Testwork\Specification\GroupedSpecificationIterator;
use Behat\Testwork\Specification\NoSpecificationsIterator;
use Behat\Testwork\Specification\SpecificationArrayIterator;
+use PHPUnit\Framework\TestCase;
-class GroupedSubjectIteratorTest extends \PHPUnit_Framework_TestCase
+class GroupedSubjectIteratorTest extends TestCase
{
public function testIterationWithEmptyAtBeginning()
{
From 83d9e0cfdc16b475ab74b6276ee3ad1e6309a184 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Thu, 16 Nov 2017 22:51:53 +0000
Subject: [PATCH 106/567] Fix error from merge conflict
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index d76139de9..2f5acf657 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"require-dev": {
"symfony/process": "~2.5|~3.0|~4.0",
- "phpunit/phpunit": "^4.8.36|^6.3"
+ "phpunit/phpunit": "^4.8.36|^6.3",
"herrera-io/box": "~1.6.1"
},
From 7a47963e73f9e864a490ee8c4a3f56f6b6b063d2 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 20 Nov 2017 08:50:25 +0000
Subject: [PATCH 107/567] Remove callable typehint
This breaks 5.3
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index bc116ddd2..533214836 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -252,7 +252,7 @@ private function applyPredicateToTypehintedArguments(
array $parameters,
array &$candidates,
array &$arguments,
- callable $predicate
+ $predicate
) {
$filtered = $this->filterApplicableTypehintedParameters($parameters);
@@ -275,7 +275,7 @@ public function matchParameterToCandidateUsingPredicate(
ReflectionParameter $parameter,
array &$candidates,
array &$arguments,
- callable $predicate
+ $predicate
) {
foreach ($candidates as $candidateIndex => $candidate) {
if (call_user_func_array($predicate, array($parameter->getClass(), $candidate))) {
From 18990c31ad0e670df7ed8a35e1ce552fea7e5d78 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 20 Nov 2017 08:56:22 +0000
Subject: [PATCH 108/567] Bump changelog
---
CHANGELOG.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26c9c258c..2e6d6fecc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+## [3.4.2] - 2017-11-20
+### Added
+ * [#1095](https://github.com/Behat/Behat/pull/1095): Support for Symfony 4.x
+ * [#1096](https://github.com/Behat/Behat/pull/1096): Allow to use latest PHPUnit
+
## [3.4.1] - 2017-09-18
### Fixed
* PHP 5.3 style cleanup.
From ccb728f6d4dc156c38c19ce7b7a7613c175e86af Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 20 Nov 2017 09:01:02 +0000
Subject: [PATCH 109/567] Fix references in the CHANGELOG
---
CHANGELOG.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e6d6fecc..92cecac23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -867,7 +867,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.1...HEAD
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.2...HEAD
+[3.4.2]: https://github.com/Behat/Behat/compare/v3.4.1...v3.4.2
[3.4.1]: https://github.com/Behat/Behat/compare/v3.4.0...v3.4.1
[3.4.0]: https://github.com/Behat/Behat/compare/v3.3.1...v3.4.0
[3.3.1]: https://github.com/Behat/Behat/compare/v3.3.0...v3.3.1
From 8789ee1efb5e3af669b7a9a9c54c48e1a3971980 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 27 Nov 2017 10:35:53 +0000
Subject: [PATCH 110/567] Fix BC break in DIC parameter resolution
Some Behat extensions already depend on Behat not resolving parameters
and handle escaping themselves. The change in 3.4 broke that behaviour
and many test suites with it.
This commit reverts the change to how it was. It does disable
environment variables again, but this is a lesser of two evils.
---
CHANGELOG.md | 7 ++++++-
src/Behat/Testwork/Cli/Application.php | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92cecac23..c6e3fbf67 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+## [3.4.3] - 2017-11-27
+### Fixed
+ * BC break due to parameters resolution in Dependency Injection Container
+
## [3.4.2] - 2017-11-20
### Added
* [#1095](https://github.com/Behat/Behat/pull/1095): Support for Symfony 4.x
@@ -867,7 +871,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.2...HEAD
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.3...HEAD
+[3.4.3]: https://github.com/Behat/Behat/compare/v3.4.2...v3.4.3
[3.4.2]: https://github.com/Behat/Behat/compare/v3.4.1...v3.4.2
[3.4.1]: https://github.com/Behat/Behat/compare/v3.4.0...v3.4.1
[3.4.0]: https://github.com/Behat/Behat/compare/v3.3.1...v3.4.0
diff --git a/src/Behat/Testwork/Cli/Application.php b/src/Behat/Testwork/Cli/Application.php
index 4189224e0..f9f35212e 100644
--- a/src/Behat/Testwork/Cli/Application.php
+++ b/src/Behat/Testwork/Cli/Application.php
@@ -184,7 +184,7 @@ private function createContainer(InputInterface $input, OutputInterface $output)
$extension = new ContainerLoader($this->extensionManager);
$extension->load($container, $this->loadConfiguration($input));
$container->addObjectResource($extension);
- $container->compile(true);
+ $container->compile();
return $container;
}
From 203ce015c92b2ebebb3d5908af4bf3d92cea81d7 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 27 Nov 2017 11:15:15 +0000
Subject: [PATCH 111/567] Relax assertions and fix yaml examples
---
features/context.feature | 9 +++------
features/definitions_patterns.feature | 6 ++----
features/execution_order.feature | 3 +--
features/extensions.feature | 3 +--
features/init.feature | 14 +++++++-------
features/junit_format.feature | 3 +--
features/suite.feature | 11 +++++------
7 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/features/context.feature b/features/context.feature
index eae21a44a..eab92c3d9 100644
--- a/features/context.feature
+++ b/features/context.feature
@@ -311,8 +311,7 @@ Feature: Context consistency
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
- [Behat\Testwork\Suite\Exception\SuiteConfigurationException]
- `contexts` setting of the "default" suite is expected to be an array, string given.
+ `contexts` setting of the "default" suite is expected to be an array, string given.
"""
Scenario: Unexisting custom context class
@@ -337,8 +336,7 @@ Feature: Context consistency
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
- [Behat\Behat\Context\Exception\ContextNotFoundException]
- `UnexistentContext` context class not found and can not be used.
+ `UnexistentContext` context class not found and can not be used.
"""
Scenario: Unexisting context argument
@@ -365,8 +363,7 @@ Feature: Context consistency
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
- [Behat\Testwork\Argument\Exception\UnknownParameterValueException]
- `CoreContext::__construct()` does not expect argument `$unexistingParam`.
+ `CoreContext::__construct()` does not expect argument `$unexistingParam`.
"""
Scenario: Suite without contexts and FeatureContext available
diff --git a/features/definitions_patterns.feature b/features/definitions_patterns.feature
index 66eeb73d2..bc62dc4a3 100644
--- a/features/definitions_patterns.feature
+++ b/features/definitions_patterns.feature
@@ -141,8 +141,7 @@ Feature: Step Definition Pattern
When I run "behat -f progress --no-colors"
Then it should fail with:
"""
- [Behat\Behat\Definition\Exception\InvalidPatternException]
- The regex `/I am (foo/` is invalid:
+ The regex `/I am (foo/` is invalid:
"""
Scenario: Pattern with default values
@@ -235,8 +234,7 @@ Feature: Step Definition Pattern
When I run "behat -f progress --no-colors"
Then it should fail with:
"""
- [Behat\Behat\Definition\Exception\InvalidPatternException]
- Token name should not exceed 32 characters, but `too1234567891123456789012345678901` was used.
+ Token name should not exceed 32 characters, but `too1234567891123456789012345678901` was used.
"""
Scenario: Multiline definitions
diff --git a/features/execution_order.feature b/features/execution_order.feature
index d778418c2..f97d2195d 100644
--- a/features/execution_order.feature
+++ b/features/execution_order.feature
@@ -61,8 +61,7 @@ Feature: Setting order of execution
When I run "behat -fpretty --order=foo"
Then it should fail with:
"""
- [Behat\Testwork\Ordering\Exception\InvalidOrderException]
- Order option 'foo' was not recognised
+ Order option 'foo' was not recognised
"""
Scenario: Reverse order
diff --git a/features/extensions.feature b/features/extensions.feature
index 9d5bd2f3f..eefaa76a7 100644
--- a/features/extensions.feature
+++ b/features/extensions.feature
@@ -119,8 +119,7 @@ Feature: Extensions
When I run "behat -f progress --no-colors"
Then it should fail with:
"""
- [Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
- `inexistent_extension` extension file or class could not be located.
+ `inexistent_extension` extension file or class could not be located.
"""
@php-version @php7.0
diff --git a/features/init.feature b/features/init.feature
index 20237800a..a4134e1d4 100644
--- a/features/init.feature
+++ b/features/init.feature
@@ -19,10 +19,10 @@ Feature: Init
And a file named "behat.yml" with:
"""
default:
- autoload: %paths.base%/supp
+ autoload: '%paths.base%/supp'
suites:
default:
- paths: [ %paths.base%/scenarios ]
+ paths: [ '%paths.base%/scenarios' ]
contexts: [ CustomContext ]
"""
When I run "behat --no-colors --init"
@@ -39,13 +39,13 @@ Feature: Init
And a file named "behat.yml" with:
"""
default:
- autoload: %paths.base%/contexts
+ autoload: '%paths.base%/contexts'
suites:
suite1:
- paths: [ %paths.base%/scenarios1 ]
+ paths: [ '%paths.base%/scenarios1' ]
contexts: [ Custom1Context ]
suite2:
- paths: [ %paths.base%/scenarios2 ]
+ paths: [ '%paths.base%/scenarios2' ]
contexts: [ Custom2Context ]
"""
When I run "behat --no-colors --init"
@@ -65,10 +65,10 @@ Feature: Init
And a file named "behat.yml" with:
"""
default:
- autoload: %paths.base%/supp
+ autoload: '%paths.base%/supp'
suites:
default:
- paths: [ %paths.base%/scenarios ]
+ paths: [ '%paths.base%/scenarios' ]
contexts:
- CustomContext: [ 'a', 'b' ]
"""
diff --git a/features/junit_format.feature b/features/junit_format.feature
index 180cd5a27..eb611f844 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -604,8 +604,7 @@
When I run "behat --no-colors -f junit -o junit.txt"
Then it should fail with:
"""
- [Behat\Testwork\Output\Exception\BadOutputPathException]
- Directory expected for the `output_path` option, but a filename was given.
+ Directory expected for the `output_path` option, but a filename was given.
"""
Scenario: Include BeforeStep Failures
diff --git a/features/suite.feature b/features/suite.feature
index 5a42d6d11..645abea17 100644
--- a/features/suite.feature
+++ b/features/suite.feature
@@ -146,10 +146,10 @@ Feature: Suites
default:
suites:
first:
- paths: [ %paths.base%/features/first ]
+ paths: [ '%paths.base%/features/first' ]
contexts: [ FirstContext ]
second:
- paths: [ %paths.base%/features/second ]
+ paths: [ '%paths.base%/features/second' ]
contexts: [ SecondContext ]
"""
When I run "behat --no-colors -fpretty --format-settings='{\"paths\": true}' features"
@@ -241,17 +241,16 @@ Feature: Suites
default:
suites:
first:
- paths: %paths.base%/features/first
+ paths: '%paths.base%/features/first'
contexts: [ FirstContext ]
second:
- paths: [ %paths.base%/features/second ]
+ paths: [ '%paths.base%/features/second' ]
contexts: [ SecondContext ]
"""
When I run "behat --no-colors -fpretty --format-settings='{\"paths\": true}' features"
Then it should fail with:
"""
- Behat\Testwork\Suite\Exception\SuiteConfigurationException]
- `paths` setting of the "first" suite is expected to be an array, string given.
+ `paths` setting of the "first" suite is expected to be an array, string given.
"""
Scenario: Role-based suites
From ec1dd6f4622b1ab6c844424b16c6fe5257676d93 Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 27 Nov 2017 11:30:07 +0000
Subject: [PATCH 112/567] Custom container must be public to be accesible by
Behat
---
features/helper_containers.feature | 1 +
1 file changed, 1 insertion(+)
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 97032f256..4ef1bddb6 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -362,6 +362,7 @@ Feature: Per-suite helper containers
public function load(ContainerBuilder $container, array $config) {
$definition = new Definition('MyContainer', array());
$definition->addTag(HelperContainerExtension::HELPER_CONTAINER_TAG);
+ $definition->setPublic(true);
if (method_exists($definition, 'setShared')) {
$definition->setShared(false); // <- Starting Symfony 2.8
From b2734e5516d0d6bbbfd50a67fabfa0611a70252b Mon Sep 17 00:00:00 2001
From: everzet
Date: Mon, 27 Nov 2017 11:47:48 +0000
Subject: [PATCH 113/567] Fix the last broken test on Symfony 4
---
features/junit_format.feature | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/features/junit_format.feature b/features/junit_format.feature
index eb611f844..6cfd9a1c1 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -373,10 +373,10 @@
contexts: [SmallKidContext]
filters:
role: small kid
- path: %paths.base%/features
+ path: '%paths.base%/features'
old_man:
contexts: [OldManContext]
- path: %paths.base%/features
+ path: '%paths.base%/features'
filters:
role: old man
"""
From c22d74ff630b659f69fd51351148761205b87e56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Tue, 28 Nov 2017 11:07:27 +0100
Subject: [PATCH 114/567] symfony/class-loader 4.0 doesn't exist
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 2f5acf657..187510289 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
"symfony/event-dispatcher": "~2.1||~3.0||~4.0",
"symfony/translation": "~2.3||~3.0||~4.0",
"symfony/yaml": "~2.1||~3.0||~4.0",
- "symfony/class-loader": "~2.1||~3.0||~4.0",
+ "symfony/class-loader": "~2.1||~3.0",
"psr/container": "^1.0",
"container-interop/container-interop": "^1.2"
},
From 3334785524b3d7ff5f5a7267d447af921e0bc249 Mon Sep 17 00:00:00 2001
From: Serhii Polishchuk
Date: Fri, 19 Jan 2018 15:48:51 +0700
Subject: [PATCH 115/567] Support BC break for constructor arguments
---
.../Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php | 6 +++---
.../Output/Node/Printer/JUnit/JUnitScenarioPrinter.php | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
index 7b3277a0d..651c4a650 100644
--- a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php
@@ -32,11 +32,11 @@ final class JUnitFeaturePrinter implements FeaturePrinter
private $statistics;
/**
- * @var JUnitDurationListener
+ * @var JUnitDurationListener|null
*/
private $durationListener;
- public function __construct(PhaseStatistics $statistics, JUnitDurationListener $durationListener)
+ public function __construct(PhaseStatistics $statistics, JUnitDurationListener $durationListener = null)
{
$this->statistics = $statistics;
$this->durationListener = $durationListener;
@@ -64,7 +64,7 @@ public function printHeader(Formatter $formatter, FeatureNode $feature)
'skipped' => $stats[TestResult::SKIPPED],
'failures' => $stats[TestResult::FAILED],
'errors' => $stats[TestResult::PENDING] + $stats[StepResult::UNDEFINED],
- 'time' => $this->durationListener->getFeatureDuration($feature)
+ 'time' => $this->durationListener ? $this->durationListener->getFeatureDuration($feature) : '',
));
$this->statistics->reset();
}
diff --git a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
index a20b6ded5..57f8906e9 100644
--- a/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php
@@ -49,11 +49,11 @@ final class JUnitScenarioPrinter
private $outlineStepCount;
/**
- * @var JUnitDurationListener
+ * @var JUnitDurationListener|null
*/
private $durationListener;
- public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener, JUnitDurationListener $durationListener)
+ public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener, JUnitDurationListener $durationListener = null)
{
$this->resultConverter = $resultConverter;
$this->outlineStoreListener = $outlineListener;
@@ -79,7 +79,7 @@ public function printOpenTag(Formatter $formatter, FeatureNode $feature, Scenari
$outputPrinter->addTestcase(array(
'name' => $name,
'status' => $this->resultConverter->convertResultToString($result),
- 'time' => $this->durationListener->getDuration($scenario)
+ 'time' => $this->durationListener ? $this->durationListener->getDuration($scenario) : ''
));
}
From 134ca5884cf1729929748fba169b51cd7b5b48e9 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Fri, 26 Jan 2018 15:02:25 +0000
Subject: [PATCH 116/567] Fix the test suite by working around a Symfony
problem
There is a BC break that broke the test suite: https://github.com/symfony/symfony/issues/25825
---
features/suite.feature | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/features/suite.feature b/features/suite.feature
index 645abea17..e59919fb2 100644
--- a/features/suite.feature
+++ b/features/suite.feature
@@ -517,7 +517,7 @@ Feature: Suites
filters:
role: big brother
"""
- When I run "behat --no-colors -sbig_brother -fpretty --format-settings='{\"paths\": true}' features"
+ When I run "behat --no-colors -s big_brother -fpretty --format-settings='{\"paths\": true}' features"
Then it should pass with:
"""
Feature: Apples story
From ce9934dd96eece73f8a9fe7a2a6db60da231c8d8 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Fri, 26 Jan 2018 21:54:33 +0000
Subject: [PATCH 117/567] Bump PHP version used in AppVeyor
---
appveyor.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/appveyor.yml b/appveyor.yml
index 945deee67..e81556764 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.1.9-nts-Win32-VC14-x86.zip
+ - PHP_DOWNLOAD_FILE: php-7.2.1-nts-Win32-VC15-x86.zip
branches:
only:
From 5fcd33b112aadf7c9cdcdb7596dd6dafb0d81048 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Fri, 26 Jan 2018 21:59:07 +0000
Subject: [PATCH 118/567] Disable colours in scenarios with complex output to
make them pass on windows again
---
features/execution_order.feature | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/features/execution_order.feature b/features/execution_order.feature
index f97d2195d..4348fe6b6 100644
--- a/features/execution_order.feature
+++ b/features/execution_order.feature
@@ -38,7 +38,7 @@ Feature: Setting order of execution
"""
Scenario: No order specified
- When I run "behat -fpretty"
+ When I run "behat -fpretty --no-colors"
Then it should pass with:
"""
Feature: Feature 1
@@ -65,7 +65,7 @@ Feature: Setting order of execution
"""
Scenario: Reverse order
- When I run "behat -fpretty --order=reverse"
+ When I run "behat -fpretty --order=reverse --no-colors"
Then it should pass with:
"""
Feature: Feature 2
From e755cc7a029ff3d1b091b5d04fe7f76eba2b900d Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Mon, 29 Jan 2018 22:02:02 +0000
Subject: [PATCH 119/567] Simplify installation instructions
At the time these instructions were written it might've been necessary to explain how to install composer. With composer becoming a de-facto standard package manager for PHP I think it's now better to assume it's installed, and refer to composer's installation docs. The installation method we have here is outdated (and insecure) anyway.
---
README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 22543cb51..9aeb64e57 100644
--- a/README.md
+++ b/README.md
@@ -14,8 +14,7 @@ Installing Behat
The easiest way to install Behat is by using [Composer](https://getcomposer.org):
```bash
-$> curl -sS https://getcomposer.org/installer | php
-$> php composer.phar require behat/behat
+$> composer require --dev behat/behat
```
After that you'll be able to run Behat via:
@@ -30,8 +29,7 @@ Installing Development Version
Clone the repository and install dependencies via [Composer](https://getcomposer.org):
```bash
-$> curl -sS https://getcomposer.org/installer | php
-$> php composer.phar install
+$> composer install
```
After that you will be able to run development version of Behat via:
From fbdaeb76ec4a82a91d6c8856262c3f7c77b8e385 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=A7=D1=83?=
=?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2?=
Date: Thu, 22 Feb 2018 16:32:58 +0300
Subject: [PATCH 120/567] Fix quoteless definition arguments matching with
unicode characters
---
CHANGELOG.md | 3 +
features/definitions_transformations.feature | 74 +++++++++++++++++
features/definitions_translations.feature | 79 +++++++++++++++++++
.../Pattern/Policy/TurnipPatternPolicy.php | 2 +-
4 files changed, 157 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6e3fbf67..6e3453d91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * [#1129](https://github.com/Behat/Behat/issues/1129): Fix quoteless
+ definition arguments matching with unicode characters
## [3.4.3] - 2017-11-27
### Fixed
diff --git a/features/definitions_transformations.feature b/features/definitions_transformations.feature
index 92c4e6f25..3063d6a13 100644
--- a/features/definitions_transformations.feature
+++ b/features/definitions_transformations.feature
@@ -565,3 +565,77 @@ Feature: Step Arguments Transformations
1 scenario (1 passed)
4 steps (4 passed)
"""
+
+ Scenario: Unicode Named Arguments Transformations
+ Given a file named "features/step_arguments_unicode.feature" with:
+ """
+ Feature: Step Arguments
+ Scenario:
+ Given I am боб
+ Then Username must be "боб"
+
+ Scenario:
+ Given I am "ÑлиÑ"
+ Then Username must be "ÑлиÑ"
+ """
+ When I run "behat -f progress --no-colors"
+ Then it should pass with:
+ """
+ ....
+
+ 2 scenarios (2 passed)
+ 4 steps (4 passed)
+ """
+
+ Scenario: Ordinal Arguments without quotes Transformations
+ Given a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ index = $index;
+ }
+
+ /** @Then the index should be :value */
+ public function theIndexShouldBe($value) {
+ PHPUnit\Framework\Assert::assertSame($value, $this->index);
+ }
+ }
+ """
+ And a file named "features/ordinal_arguments.feature" with:
+ """
+ Feature: Ordinal Step Arguments
+ Scenario:
+ Given I pick the 1st thing
+ Then the index should be "1"
+ Scenario:
+ Given I pick the "1st" thing
+ Then the index should be "1"
+ Scenario:
+ Given I pick the 27th thing
+ Then the index should be "27"
+ Scenario:
+ Given I pick the 5 thing
+ Then the index should be "5"
+ """
+ When I run "behat -f progress --no-colors"
+ Then it should pass with:
+ """
+ ........
+
+ 4 scenarios (4 passed)
+ 8 steps (8 passed)
+ """
diff --git a/features/definitions_translations.feature b/features/definitions_translations.feature
index c3ace9d05..b5d17e862 100644
--- a/features/definitions_translations.feature
+++ b/features/definitions_translations.feature
@@ -359,3 +359,82 @@ Feature: Definitions translations
2 scenarios (2 passed)
10 steps (10 passed)
"""
+
+ Scenario: Translations with arguments without quotes
+ Given a file named "features/calc_ru_arguments.feature" with:
+ """
+ # language: ru
+ ФункциÑ: ИндекÑÑ‹
+
+ Сценарий:
+ ДопуÑтим Я беру 14ую вещь
+ То Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть "14"
+
+ Сценарий:
+ ДопуÑтим Я беру "2ÑŽ" вещь
+ То Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть "2"
+
+ Сценарий:
+ ДопуÑтим Я беру 5 вещь
+ То Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть "5"
+
+ Сценарий:
+ ДопуÑтим Я беру "10" вещь
+ То Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть "10"
+ """
+ And a file named "features/bootstrap/FeatureContext.php" with:
+ """
+ index = $index;
+ }
+
+ /** @Then /^the index should be "([^"]*)"$/ */
+ public function theIndexShouldBe($value) {
+ PHPUnit\Framework\Assert::assertSame($value, $this->index);
+ }
+
+ public static function getTranslationResources() {
+ return array(__DIR__ . DIRECTORY_SEPARATOR . 'i18n' . DIRECTORY_SEPARATOR . 'ru.xliff');
+ }
+ }
+ """
+ And a file named "features/bootstrap/i18n/ru.xliff" with:
+ """
+
+
+
+
+
+ I pick the :index thing
+ Ñ Ð±ÐµÑ€Ñƒ :index вещь
+
+
+ /^the index should be "([^"]*)"$/
+ /^Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ быть "([^"]*)"$/
+
+
+
+
+ """
+ When I run "behat --no-colors -f progress features/calc_ru_arguments.feature"
+ Then it should pass with:
+ """
+ ........
+
+ 4 scenarios (4 passed)
+ 8 steps (8 passed)
+ """
diff --git a/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php b/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php
index c0732680f..0fbb8fc32 100644
--- a/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php
+++ b/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php
@@ -100,7 +100,7 @@ private function createTransformedRegex($pattern)
$regex = $this->replaceTurnipOptionalEndingWithRegex($regex);
$regex = $this->replaceTurnipAlternativeWordsWithRegex($regex);
- return '/^' . $regex . '$/i';
+ return '/^' . $regex . '$/iu';
}
/**
From 9c7447110ce50dcce1efacc61f745112bc8c463c Mon Sep 17 00:00:00 2001
From: Samuele Lilli
Date: Mon, 19 Mar 2018 17:17:08 +0100
Subject: [PATCH 121/567] Update composer.json
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 187510289..7cc4af70d 100644
--- a/composer.json
+++ b/composer.json
@@ -50,7 +50,7 @@
"extra": {
"branch-alias": {
- "dev-master": "3.2.x-dev"
+ "dev-master": "3.4.x-dev"
}
},
From 0b342b1bb404ac3b082d8eb54cc9f7c57b7cdd27 Mon Sep 17 00:00:00 2001
From: John Eismeier
Date: Tue, 3 Apr 2018 09:11:29 -0400
Subject: [PATCH 122/567] Propose fix two typos
---
features/definitions_override.feature | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/features/definitions_override.feature b/features/definitions_override.feature
index 464a63cd3..6ee2ebdf3 100644
--- a/features/definitions_override.feature
+++ b/features/definitions_override.feature
@@ -3,7 +3,7 @@ Feature: Step Definitions Override
As a step definitions developer
I need to be able to override definition methods
- Scenario: Overriden method without own annotation will inherit parent pattern
+ Scenario: Overridden method without own annotation will inherit parent pattern
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
Date: Thu, 10 May 2018 09:26:34 +0100
Subject: [PATCH 123/567] Use the Symfony hosted version of PHP
---
appveyor.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index e81556764..46b951ef0 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.2.1-nts-Win32-VC15-x86.zip
+ - PHP_DOWNLOAD_FILE: php-7.1.3-Win32-VC14-x86.zip
branches:
only:
@@ -28,7 +28,7 @@ init:
install:
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
- cd c:\php
- - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/%PHP_DOWNLOAD_FILE%
+ - IF %PHP%==1 appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/%PHP_DOWNLOAD_FILE%
- IF %PHP%==1 7z x %PHP_DOWNLOAD_FILE% -y > 7z.log
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor DownloadFile https://getcomposer.org/composer.phar
From 6eff2378fdbdecfd6443d4d640d4d8530c7f79bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 18:20:12 +0200
Subject: [PATCH 124/567] Rework appveyor
---
appveyor.yml | 53 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 18 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index 46b951ef0..58e8a4eba 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,7 +6,7 @@ clone_folder: c:\projects\behat
environment:
matrix:
- - PHP_DOWNLOAD_FILE: php-7.1.3-Win32-VC14-x86.zip
+ - php: 7.2
branches:
only:
@@ -16,31 +16,48 @@ skip_commits:
message: /\[ci skip\]/
cache:
- - c:\php -> appveyor.yml
+ - C:\ProgramData\chocolatey\bin -> appveyor.yml
+ - C:\ProgramData\chocolatey\lib -> appveyor.yml
+ - C:\tools\php -> appveyor.yml
+ - C:\tools\composer -> appveyor.yml
+ - '%LOCALAPPDATA%\Composer\files'
init:
- - SET PATH=c:\php;%PATH%
+ - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- - SET PHP=1
- SET ANSICON=121x90 (121x90)
- git config --global core.autocrlf input
install:
- - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
- - cd c:\php
- - IF %PHP%==1 appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/%PHP_DOWNLOAD_FILE%
- - IF %PHP%==1 7z x %PHP_DOWNLOAD_FILE% -y > 7z.log
- - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- - appveyor DownloadFile https://getcomposer.org/composer.phar
- - copy php.ini-production php.ini /Y
- - echo date.timezone="UTC" >> php.ini
- - echo extension_dir=ext >> php.ini
- - echo extension=php_openssl.dll >> php.ini
- - echo extension=php_curl.dll >> php.ini
- - echo extension=php_mbstring.dll >> php.ini
- - echo extension=php_fileinfo.dll >> php.ini
+ - ps: |
+ if (!(Test-Path c:\tools\php)) {
+ appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
+ Get-ChildItem -Path c:\tools\php
+ cd c:\tools\php
+
+ # Set PHP environment items that are always needed
+ copy php.ini-production php.ini
+ Add-Content php.ini "`n date.timezone=UTC"
+ Add-Content php.ini "`n extension_dir=ext"
+ Add-Content php.ini "`n extension=php_openssl.dll"
+ Add-Content php.ini "`n extension=php_curl.dll"
+ Add-Content php.ini "`n extension=php_mbstring.dll"
+ Add-Content php.ini "`n extension=php_fileinfo.dll"
+
+ # download Composer
+ if (!(Test-Path C:\tools\composer)) {
+ New-Item -path c:\tools -name composer -itemtype directory
+ }
+
+ if (!(Test-Path c:\tools\composer\composer.phar)) {
+ appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar -Filename C:\tools\composer\composer.phar
+ Set-Content -path 'C:\tools\composer\composer.bat' -Value ('@php C:\tools\composer\composer.phar %*')
+ }
+ }
+
- cd c:\projects\behat
- - composer install --no-progress --ansi
+ - appveyor-retry composer self-update
+ - appveyor-retry composer install --no-progress --ansi
test_script:
- cd c:\projects\behat
From 4008e193cbcd766abab5b8437108197b26f66b95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 18:20:52 +0200
Subject: [PATCH 125/567] Test travis against php 7.2
---
.travis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 0b0cc2102..ba30bbf04 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: php
-php: [5.6, 7.0, 7.1]
+php: [5.6, 7.0, 7.1, 7.2]
sudo: false
@@ -20,8 +20,8 @@ matrix:
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- - php: 7.1
- env: SYMFONY_VERSION='4.0.*@dev'
+ - php: 7.2
+ env: SYMFONY_VERSION='^3.4'
before_install:
- phpenv config-rm xdebug.ini
From 8fd30e8e7f4aa1c1bbacb3c29b2597ac6455e254 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Paris?=
Date: Mon, 21 May 2018 19:08:46 +0200
Subject: [PATCH 126/567] Remove trailing whitespace
---
src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index c39488ae6..3d4607978 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -51,7 +51,7 @@ public function __construct(TranslatorInterface $translator, InputInterface $inp
$this->input = $input;
$this->output = $output;
}
-
+
/**
* {@inheritdoc}
*/
From 7581001fb9426e763e4f018395ee33af8e70ce01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Paris?=
Date: Mon, 21 May 2018 19:06:58 +0200
Subject: [PATCH 127/567] Use a valid key as the default
This is how the QuestionHelper API was intended to be used, but it only
has been so since a recent bugfix.
See https://github.com/symfony/symfony/pull/25521
Fixes #1151
---
composer.json | 2 +-
src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 187510289..2b2ecd56e 100644
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,7 @@
"ext-mbstring": "*",
"behat/gherkin": "^4.5.1",
"behat/transliterator": "^1.2",
- "symfony/console": "~2.5||~3.0||~4.0",
+ "symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3",
"symfony/config": "~2.3||~3.0||~4.0",
"symfony/dependency-injection": "~2.1||~3.0||~4.0",
"symfony/event-dispatcher": "~2.1||~3.0||~4.0",
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 3d4607978..52a3eb934 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -70,7 +70,7 @@ public function guessTargetContextClass(ContextEnvironment $environment)
$message = $this->translator->trans('snippet_context_choice', array('%1%' => $suiteName), 'output');
$choices = array_values(array_merge(array('None'), $contextClasses));
- $default = current($contextClasses);
+ $default = 1;
$answer = $this->askQuestion('>> ' . $message, $choices, $default);
From 016789cc28b2981be7880a07c6025be6c05adf8c Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Jun 2018 12:25:31 +0100
Subject: [PATCH 128/567] Migrate to new scrutinizer
https://scrutinizer-ci.com/docs/tools/php/php-analyzer/guides/migrate_to_new_php_analysis
---
.scrutinizer.yml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 43634ee11..04255e8ea 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -58,3 +58,10 @@ checks:
no_exit: false
no_unnecessary_final_modifier: false
overriding_private_members: false
+
+build:
+ nodes:
+ analysis:
+ tests:
+ override:
+ - php-scrutinizer-run
From 9c675380c13da71527c10c761c335765579332e2 Mon Sep 17 00:00:00 2001
From: everzet
Date: Sat, 2 Jun 2018 12:46:25 +0100
Subject: [PATCH 129/567] Remove suggestions from composer.json
[ci skip]
---
composer.json | 6 ------
1 file changed, 6 deletions(-)
diff --git a/composer.json b/composer.json
index ea7304652..523fd6bbd 100644
--- a/composer.json
+++ b/composer.json
@@ -35,12 +35,6 @@
"herrera-io/box": "~1.6.1"
},
- "suggest": {
- "behat/symfony2-extension": "for integration with Symfony2 web framework",
- "behat/yii-extension": "for integration with Yii web framework",
- "behat/mink-extension": "for integration with Mink testing framework"
- },
-
"autoload": {
"psr-0": {
"Behat\\Behat": "src/",
From 8a993829942bddfb3c40680d7ded9a37eb8f925c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 00:53:49 +0200
Subject: [PATCH 130/567] Do not call mb_strpos on non-string arguments
---
src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
index 9e16f32de..7e2191a0f 100644
--- a/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
+++ b/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php
@@ -63,7 +63,7 @@ public function resolveArguments(ReflectionClass $classReflection, array $argume
*/
private function resolveArgument($value)
{
- if (0 === mb_strpos($value, '@')) {
+ if (is_string($value) && 0 === mb_strpos($value, '@')) {
return $this->container->get(mb_substr($value, 1));
}
From 27259f972ebeec7dae0f2a10347f6b9daec354d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 01:00:55 +0200
Subject: [PATCH 131/567] Add scenario for array arguments
---
features/context.feature | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/features/context.feature b/features/context.feature
index eab92c3d9..684f23330 100644
--- a/features/context.feature
+++ b/features/context.feature
@@ -466,3 +466,42 @@ Feature: Context consistency
2 scenarios (2 passed)
2 steps (2 passed)
"""
+
+ Scenario: Array arguments
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - [foo, bar]
+ """
+ And a file named "features/context-args-array.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given foo
+ """
+ And a file named "features/bootstrap/FirstContext.php" with:
+ """
+ foo = $foo;
+ }
+
+ /** @Given foo */
+ public function foo() {
+ PHPUnit\Framework\Assert::assertInternalType('array', $this->foo);
+
+ PHPUnit\Framework\Assert::assertSame('foo', $this->foo[0]);
+ PHPUnit\Framework\Assert::assertSame('bar', $this->foo[1]);
+ }
+ }
+ """
+ When I run "behat --no-colors -f progress features/context-args-array.feature"
+ Then it should pass
From 9fb5a224ccc2caaccd5e28571b49765d6c2b61f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 01:16:45 +0200
Subject: [PATCH 132/567] Update CHANGELOG
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6e3fbf67..5fd9442b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * [#1144](https://github.com/Behat/Behat/pull/1144) : Allow to use arrays as context parameters
## [3.4.3] - 2017-11-27
### Fixed
From c332a7b04629eed464ffa4220384285e437fc249 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Mon, 25 Sep 2017 01:24:06 +0200
Subject: [PATCH 133/567] Check with array_key_exists for autowiring arguments
isset() returns false for `null` value, so if we put a `null` value
in the list arguments, it will be ignored and "something else" can
be used instead.
This is particularly bothersome if the type-hinted class does not
exist, even though a `null` value has been specifically used.
---
src/Behat/Behat/HelperContainer/ArgumentAutowirer.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
index d4d514728..00dbbcded 100644
--- a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
+++ b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
@@ -72,6 +72,6 @@ public function autowireArguments(ReflectionFunctionAbstract $reflection, array
*/
private function isArgumentWireable(array $arguments, $index, ReflectionParameter $parameter)
{
- return !isset($arguments[$index]) && !isset($arguments[$parameter->getName()]) && $parameter->getClass();
+ return !isset($arguments[$index]) && !isset($arguments[$parameter->getName()]) && !array_key_exists($index, $arguments) && !array_key_exists($parameter->getName(), $arguments) && $parameter->getClass();
}
}
From 6a48d28b06f3059f9a44e2f08f78c6955bb354bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Mon, 25 Sep 2017 01:32:04 +0200
Subject: [PATCH 134/567] Make the condition more readable in ArgumentAutowirer
---
.../Behat/HelperContainer/ArgumentAutowirer.php | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
index 00dbbcded..8771eabdc 100644
--- a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
+++ b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
@@ -14,6 +14,7 @@
use Psr\Container\ContainerInterface;
use ReflectionFunctionAbstract;
use ReflectionParameter;
+use ReflectionException;
/**
* Automatically wires arguments of a given function from inside the container by using type-hitns.
@@ -72,6 +73,18 @@ public function autowireArguments(ReflectionFunctionAbstract $reflection, array
*/
private function isArgumentWireable(array $arguments, $index, ReflectionParameter $parameter)
{
- return !isset($arguments[$index]) && !isset($arguments[$parameter->getName()]) && !array_key_exists($index, $arguments) && !array_key_exists($parameter->getName(), $arguments) && $parameter->getClass();
+ if (isset($arguments[$index]) || array_key_exists($index, $arguments)) {
+ return false;
+ }
+
+ if (isset($arguments[$parameter->getName()]) || array_key_exists($parameter->getName(), $arguments)) {
+ return false;
+ }
+
+ try {
+ return (bool) $parameter->getClass();
+ } catch (ReflectionException $e) {
+ return false;
+ }
}
}
From e2fc74749352f57866881b0f51a7a05221b96764 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Mon, 25 Sep 2017 01:40:16 +0200
Subject: [PATCH 135/567] Add scenario for null arguments and autowire
---
features/autowire.feature | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/features/autowire.feature b/features/autowire.feature
index 86cff9a69..5e2be789a 100644
--- a/features/autowire.feature
+++ b/features/autowire.feature
@@ -106,6 +106,41 @@ Feature: Helper services autowire
When I run "behat --no-colors -f progress features/autowire.feature"
Then it should pass
+ Scenario: Null arguments should be skipped
+ Given a file named "behat.yaml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FeatureContext:
+ name: null
+ services: ServiceContainer
+ autowire: true
+ """
+ And a file named "features/autowire.feature" with:
+ """
+ Feature:
+ Scenario:
+ Given a step
+ """
+ And a file named "features/bootstrap/FeatureContext.php" with:
+ """
+
Date: Mon, 25 Sep 2017 11:42:49 +0200
Subject: [PATCH 136/567] If ->getClass() is not available, ignore it
---
src/Behat/Testwork/Argument/MixedArgumentOrganiser.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index 533214836..c845f03d4 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -13,6 +13,7 @@
use ReflectionFunctionAbstract;
use ReflectionClass;
use ReflectionParameter;
+use ReflectionException;
/**
* Organises function arguments using its reflection.
@@ -225,7 +226,11 @@ private function filterApplicableTypehintedParameters(array $parameters)
continue;
}
- $reflectionClass = $parameter->getClass();
+ try {
+ $reflectionClass = $parameter->getClass();
+ } catch (ReflectionException $e) {
+ continue;
+ }
if (!$reflectionClass) {
continue;
From 80e734055295b2b4c7503d662c6ec349fbecac58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Baptiste=20Clavi=C3=A9?=
Date: Thu, 10 May 2018 01:19:07 +0200
Subject: [PATCH 137/567] Update CHANGELOG
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6e3fbf67..5ea490ffe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * [#1081](https://github.com/Behat/Behat/pull/1081): Do not use isset to be
+ able to check for intentional `null` values when autowiring contexts
## [3.4.3] - 2017-11-27
### Fixed
From 8ba1ea4c5c3f7d5a39408c4807e590a153846ffc Mon Sep 17 00:00:00 2001
From: Julien Deniau
Date: Tue, 29 May 2018 14:17:31 +0200
Subject: [PATCH 138/567] add local cache for transformPatternToRegex
---
.../Definition/Pattern/PatternTransformer.php | 14 +++-
.../Pattern/PatternTransformerTest.php | 68 +++++++++++++++++++
2 files changed, 79 insertions(+), 3 deletions(-)
create mode 100644 tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
diff --git a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
index 6af5bacd6..d632e2567 100644
--- a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
+++ b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
@@ -26,6 +26,8 @@ final class PatternTransformer
*/
private $policies = array();
+ private $patternToRegexpCache = array();
+
/**
* Registers pattern policy.
*
@@ -34,6 +36,7 @@ final class PatternTransformer
public function registerPatternPolicy(PatternPolicy $policy)
{
$this->policies[] = $policy;
+ $this->patternToRegexpCache = array();
}
/**
@@ -68,11 +71,16 @@ public function generatePattern($type, $stepText)
*/
public function transformPatternToRegex($pattern)
{
- foreach ($this->policies as $policy) {
- if ($policy->supportsPattern($pattern)) {
- return $policy->transformPatternToRegex($pattern);
+ if (!isset($this->patternToRegexpCache[$pattern])) {
+ foreach ($this->policies as $policy) {
+ if ($policy->supportsPattern($pattern)) {
+ $this->patternToRegexpCache[$pattern] = $policy->transformPatternToRegex($pattern);
+ break;
+ }
}
}
+ return $this->patternToRegexpCache[$pattern];
+
throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern);
}
diff --git a/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
new file mode 100644
index 000000000..015eeeb70
--- /dev/null
+++ b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
@@ -0,0 +1,68 @@
+
+ */
+class PatternTransformerTest extends TestCase
+{
+ public function testTransformPatternToRegexCache()
+ {
+ $observer = $this->prophesize(PatternPolicy::class);
+ // first pattern
+ $observer->supportsPattern('hello world')->willReturn(true);
+ $observer->transformPatternToRegex('hello world')
+ ->shouldBeCalledTimes(1)
+ ->willReturn('/hello world/');
+
+ // second pattern
+ $observer->supportsPattern('hi world')->willReturn(true);
+ $observer->transformPatternToRegex('hi world')
+ ->shouldBeCalledTimes(1)
+ ->willReturn('/hi world/');
+
+ $testedInstance = new PatternTransformer();
+ $testedInstance->registerPatternPolicy($observer->reveal());
+ $regex = $testedInstance->transformPatternToRegex('hello world');
+ $regex2 = $testedInstance->transformPatternToRegex('hello world');
+
+ $regex3 = $testedInstance->transformPatternToRegex('hi world');
+
+ $this->assertEquals('/hello world/', $regex);
+ $this->assertEquals('/hello world/', $regex2);
+ $this->assertEquals('/hi world/', $regex3);
+ }
+
+ public function testTransformPatternToRegexCacheAndRegisterNewPolicy()
+ {
+ // first pattern
+ $policy1Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy1Prophecy->supportsPattern('hello world')->willReturn(true);
+ $policy1Prophecy->transformPatternToRegex('hello world')
+ ->shouldBeCalledTimes(2)
+ ->willReturn('/hello world/');
+
+ // second pattern
+ $policy2Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy1Prophecy->supportsPattern()->shouldNotBeCalled();
+ $policy1Prophecy->transformPatternToRegex()->shouldNotBeCalled();
+
+ $testedInstance = new PatternTransformer();
+ $testedInstance->registerPatternPolicy($policy1Prophecy->reveal());
+ $regex = $testedInstance->transformPatternToRegex('hello world');
+ $regex2 = $testedInstance->transformPatternToRegex('hello world');
+
+ $testedInstance->registerPatternPolicy($policy2Prophecy->reveal());
+ $regex3 = $testedInstance->transformPatternToRegex('hello world');
+
+ $this->assertEquals('/hello world/', $regex);
+ $this->assertEquals('/hello world/', $regex2);
+ $this->assertEquals('/hello world/', $regex3);
+ }
+}
From b04cc572ebf6058fdbe69d5add8b60892fc013ce Mon Sep 17 00:00:00 2001
From: Julien Deniau
Date: Tue, 29 May 2018 15:49:11 +0200
Subject: [PATCH 139/567] add test to check that transformPatternToRegex throw
an exception if no match is found
---
.../Definition/Pattern/PatternTransformer.php | 6 ++++--
.../Pattern/PatternTransformerTest.php | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
index d632e2567..3d4787b26 100644
--- a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
+++ b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
@@ -79,9 +79,11 @@ public function transformPatternToRegex($pattern)
}
}
}
- return $this->patternToRegexpCache[$pattern];
+ if (!isset($this->patternToRegexpCache[$pattern])) {
+ throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern);
+ }
- throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern);
+ return $this->patternToRegexpCache[$pattern];
}
}
diff --git a/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
index 015eeeb70..44aca4825 100644
--- a/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
+++ b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
@@ -65,4 +65,22 @@ public function testTransformPatternToRegexCacheAndRegisterNewPolicy()
$this->assertEquals('/hello world/', $regex2);
$this->assertEquals('/hello world/', $regex3);
}
+
+ /**
+ * @expectedException \Behat\Behat\Definition\Exception\UnknownPatternException
+ * @expectedExceptionMessage Can not find policy for a pattern `hello world`.
+ */
+ public function testTransformPatternToRegexNoMatch()
+ {
+ // first pattern
+ $policy1Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy1Prophecy->supportsPattern('hello world')->willReturn(false);
+ $policy1Prophecy->transformPatternToRegex('hello world')
+ ->shouldNotBeCalled();
+
+
+ $testedInstance = new PatternTransformer();
+ $testedInstance->registerPatternPolicy($policy1Prophecy->reveal());
+ $regex = $testedInstance->transformPatternToRegex('hello world');
+ }
}
From 615459bfb7f759fc212ea86a16f35e2f9d3029df Mon Sep 17 00:00:00 2001
From: Julien Deniau
Date: Wed, 30 May 2018 14:05:19 +0200
Subject: [PATCH 140/567] simplify public method
---
.../Definition/Pattern/PatternTransformer.php | 20 ++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
index 3d4787b26..204cbd80e 100644
--- a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
+++ b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
@@ -72,18 +72,20 @@ public function generatePattern($type, $stepText)
public function transformPatternToRegex($pattern)
{
if (!isset($this->patternToRegexpCache[$pattern])) {
- foreach ($this->policies as $policy) {
- if ($policy->supportsPattern($pattern)) {
- $this->patternToRegexpCache[$pattern] = $policy->transformPatternToRegex($pattern);
- break;
- }
- }
+ $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern);
}
- if (!isset($this->patternToRegexpCache[$pattern])) {
- throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern);
+ return $this->patternToRegexpCache[$pattern];
+ }
+
+ private function transformPatternToRegexWithSupportedPolicy($pattern)
+ {
+ foreach ($this->policies as $policy) {
+ if ($policy->supportsPattern($pattern)) {
+ return $policy->transformPatternToRegex($pattern);
+ }
}
- return $this->patternToRegexpCache[$pattern];
+ throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern);
}
}
From a95d38a5ddfc859fbd99388393acc7dea832f271 Mon Sep 17 00:00:00 2001
From: Julien Deniau
Date: Mon, 4 Jun 2018 09:41:53 +0200
Subject: [PATCH 141/567] add typehint
---
.../Behat/Definition/Pattern/PatternTransformer.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
index 204cbd80e..adda52b66 100644
--- a/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
+++ b/src/Behat/Behat/Definition/Pattern/PatternTransformer.php
@@ -26,6 +26,9 @@ final class PatternTransformer
*/
private $policies = array();
+ /**
+ * @var string[]
+ */
private $patternToRegexpCache = array();
/**
@@ -78,6 +81,13 @@ public function transformPatternToRegex($pattern)
return $this->patternToRegexpCache[$pattern];
}
+ /**
+ * @param string $pattern
+ *
+ * @return string
+ *
+ * @throws UnknownPatternException
+ */
private function transformPatternToRegexWithSupportedPolicy($pattern)
{
foreach ($this->policies as $policy) {
From be0d6196b24bd3920269b5d052decb5d9d7d4d3e Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Tue, 3 Jul 2018 11:58:42 +0100
Subject: [PATCH 142/567] Register cli input/output services as synthetic
---
src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php b/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
index 497993cef..352b2d6a6 100644
--- a/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
+++ b/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php
@@ -81,6 +81,7 @@ public function configure(ArrayNodeDefinition $builder)
public function load(ContainerBuilder $container, array $config)
{
$this->loadCommand($container);
+ $this->loadSyntheticServices($container);
}
/**
@@ -103,6 +104,12 @@ protected function loadCommand(ContainerBuilder $container)
$container->setDefinition(self::COMMAND_ID, $definition);
}
+ protected function loadSyntheticServices(ContainerBuilder $container)
+ {
+ $container->register(self::INPUT_ID)->setSynthetic(true)->setPublic(true);
+ $container->register(self::OUTPUT_ID)->setSynthetic(true)->setPublic(true);
+ }
+
/**
* Processes all controllers in container.
*
From 8f9c9d9a4dc857bc3d7437bd4ea27d3e2b2297d7 Mon Sep 17 00:00:00 2001
From: Phil Weir
Date: Thu, 12 Jul 2018 16:31:28 +0100
Subject: [PATCH 143/567] Allow for new-style Symfony serialization
Fixes #1108 by changing the argument to the HelperContainerExtension to
be a Symfony DI Reference to the service container rather than the
instantiated service container itself.
---
.../ServiceContainer/HelperContainerExtension.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php b/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
index 1d5100f5c..ab9c3cb53 100644
--- a/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
+++ b/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php
@@ -19,6 +19,7 @@
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Reference;
/**
* Behat helper container extension.
@@ -76,7 +77,9 @@ public function configure(ArrayNodeDefinition $builder)
*/
public function load(ContainerBuilder $container, array $config)
{
- $definition = new Definition('Behat\Behat\HelperContainer\Argument\ServicesResolverFactory', array($container));
+ $definition = new Definition('Behat\Behat\HelperContainer\Argument\ServicesResolverFactory', array(
+ new Reference('service_container')
+ ));
$definition->addTag(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG, array('priority' => 0));
$container->setDefinition(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG . '.helper_container', $definition);
From 6169bb41593290ce549f34bd3156c6396c553aa9 Mon Sep 17 00:00:00 2001
From: Phil Weir
Date: Thu, 12 Jul 2018 19:02:21 +0100
Subject: [PATCH 144/567] update CHANGELOG to note serialization fix
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6e3fbf67..fe14c339f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Fixed
+ * Serializable definitions for Symfony 4.x
## [3.4.3] - 2017-11-27
### Fixed
From 29df00633392c6bfca5f8319a4f0c8af36dd9350 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Mon, 6 Aug 2018 17:38:49 +0100
Subject: [PATCH 145/567] Updated changelog
---
CHANGELOG.md | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb97927d8..1fd71d465 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,9 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- * [#1144](https://github.com/Behat/Behat/pull/1144) : Support for arrays as context parameters
+ * [#1144](https://github.com/Behat/Behat/pull/1144) : Allow to use arrays as context parameters
+
+### Changed
+ * [#1153](https://github.com/Behat/Behat/pull/1153) : Cache pattern to regex transformations
+ * [#1155](https://github.com/Behat/Behat/pull/1155) : Remove composer suggestions
+
### Fixed
- * Serializable definitions for Symfony 4.x
+ * Custom container must be public for symfony 4
+ * [#1160](https://github.com/Behat/Behat/pull/1160) : Register CLI services as synthetic
+ * [#1163](https://github.com/Behat/Behat/pull/1163) : Allow for new-style symfony serialisation
## [3.4.3] - 2017-11-27
### Fixed
From 74aa665d3201a012eb7267b2bf672eafa35b5f75 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Mon, 6 Aug 2018 19:38:14 +0100
Subject: [PATCH 146/567] 3.5.0 release prep
---
composer.json | 2 +-
src/Behat/Behat/ApplicationFactory.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 523fd6bbd..4a6cbb70f 100644
--- a/composer.json
+++ b/composer.json
@@ -44,7 +44,7 @@
"extra": {
"branch-alias": {
- "dev-master": "3.4.x-dev"
+ "dev-master": "3.5.x-dev"
}
},
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index 261094881..d9838a1fb 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -46,7 +46,7 @@
*/
final class ApplicationFactory extends BaseFactory
{
- const VERSION = '3.4-dev';
+ const VERSION = '3.5.0';
/**
* {@inheritdoc}
From 1c93c1411a6ce4967af88b91cb180c76e82d6761 Mon Sep 17 00:00:00 2001
From: Konstantin Kudryashov
Date: Fri, 10 Aug 2018 19:56:03 +0100
Subject: [PATCH 147/567] Link 3.5.0 changeset
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3679ee294..ac30094ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -885,7 +885,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
-[Unreleased]: https://github.com/Behat/Behat/compare/v3.4.3...HEAD
+[3.5.0]: https://github.com/Behat/Behat/compare/v3.4.3...v3.5.0
[3.4.3]: https://github.com/Behat/Behat/compare/v3.4.2...v3.4.3
[3.4.2]: https://github.com/Behat/Behat/compare/v3.4.1...v3.4.2
[3.4.1]: https://github.com/Behat/Behat/compare/v3.4.0...v3.4.1
From e4bce688be0c2029dc1700e46058d86428c63cab Mon Sep 17 00:00:00 2001
From: Konstantin Kudryashov
Date: Fri, 10 Aug 2018 19:56:51 +0100
Subject: [PATCH 148/567] Change the date of release
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac30094ae..54acf1e1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
-## [3.5.0] - 2018-08-06
+## [3.5.0] - 2018-08-10
### Added
* [#1144](https://github.com/Behat/Behat/pull/1144): Allow to use arrays as context parameters
* [#1081](https://github.com/Behat/Behat/pull/1081): Allow passing null as a named context parameter
From a2fb304fce186292f11b16f5fc186e5cc456dbd6 Mon Sep 17 00:00:00 2001
From: Konstantin Kudryashov
Date: Fri, 10 Aug 2018 19:58:42 +0100
Subject: [PATCH 149/567] Add unreleased section back
---
CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54acf1e1e..b758751ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [Unreleased]
+
## [3.5.0] - 2018-08-10
### Added
* [#1144](https://github.com/Behat/Behat/pull/1144): Allow to use arrays as context parameters
@@ -885,6 +887,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
* Initial release
+[Unreleased]: https://github.com/Behat/Behat/compare/v3.5.0...master
[3.5.0]: https://github.com/Behat/Behat/compare/v3.4.3...v3.5.0
[3.4.3]: https://github.com/Behat/Behat/compare/v3.4.2...v3.4.3
[3.4.2]: https://github.com/Behat/Behat/compare/v3.4.1...v3.4.2
From a5a6745c378fbe1049714a9508be620ec171b7c8 Mon Sep 17 00:00:00 2001
From: Felds Liscia
Date: Tue, 28 Aug 2018 16:24:46 -0300
Subject: [PATCH 150/567] replace symfony class loader with composer
---
.../Behat/Context/Suite/Setup/SuiteWithContextsSetup.php | 2 +-
.../Testwork/Autoloader/Cli/AutoloaderController.php | 2 +-
.../Autoloader/ServiceContainer/AutoloaderExtension.php | 8 ++++++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
index 0bc41db7a..9fc219d3a 100644
--- a/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
+++ b/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php
@@ -16,7 +16,7 @@
use Behat\Testwork\Suite\Exception\SuiteConfigurationException;
use Behat\Testwork\Suite\Setup\SuiteSetup;
use Behat\Testwork\Suite\Suite;
-use Symfony\Component\ClassLoader\ClassLoader;
+use Composer\Autoload\ClassLoader;
/**
* Generates classes for all contexts in the suite using autoloader.
diff --git a/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php b/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php
index 991eb412c..70ebe94af 100644
--- a/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php
+++ b/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php
@@ -11,7 +11,7 @@
namespace Behat\Testwork\Autoloader\Cli;
use Behat\Testwork\Cli\Controller;
-use Symfony\Component\ClassLoader\ClassLoader;
+use Composer\Autoload\ClassLoader;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
diff --git a/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php b/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
index 2c5f021cd..476601345 100644
--- a/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
+++ b/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
@@ -108,7 +108,7 @@ public function process(ContainerBuilder $container)
*/
private function loadAutoloader(ContainerBuilder $container)
{
- $definition = new Definition('Symfony\Component\ClassLoader\ClassLoader');
+ $definition = new Definition('Composer\Autoload\ClassLoader');
$container->setDefinition(self::CLASS_LOADER_ID, $definition);
}
@@ -146,6 +146,10 @@ private function setLoaderPrefixes(ContainerBuilder $container, array $prefixes)
private function processLoaderPrefixes(ContainerBuilder $container)
{
$loaderDefinition = $container->getDefinition(self::CLASS_LOADER_ID);
- $loaderDefinition->addMethodCall('addPrefixes', array($container->getParameter('class_loader.prefixes')));
+ $prefixes = $container->getParameter('class_loader.prefixes');
+
+ foreach ($prefixes as $prefix => $path) {
+ $loaderDefinition->addMethodCall('addPsr4', array($prefix, $path));
+ }
}
}
From afa775441bde81fed047e8ce766f992c2bf3068f Mon Sep 17 00:00:00 2001
From: Felds Liscia
Date: Tue, 28 Aug 2018 19:12:58 -0300
Subject: [PATCH 151/567] add prefixes as PSR0
---
.../Autoloader/ServiceContainer/AutoloaderExtension.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php b/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
index 476601345..40f0fa226 100644
--- a/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
+++ b/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php
@@ -149,7 +149,7 @@ private function processLoaderPrefixes(ContainerBuilder $container)
$prefixes = $container->getParameter('class_loader.prefixes');
foreach ($prefixes as $prefix => $path) {
- $loaderDefinition->addMethodCall('addPsr4', array($prefix, $path));
+ $loaderDefinition->addMethodCall('add', array($prefix, $path));
}
}
}
From fc001f9269e20ae4007bb90532a6a727ceb2002a Mon Sep 17 00:00:00 2001
From: Felds Liscia
Date: Wed, 29 Aug 2018 11:47:05 -0300
Subject: [PATCH 152/567] remove symfony/class-loader dependency
---
composer.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/composer.json b/composer.json
index 4a6cbb70f..dfb31dc41 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,6 @@
"symfony/event-dispatcher": "~2.1||~3.0||~4.0",
"symfony/translation": "~2.3||~3.0||~4.0",
"symfony/yaml": "~2.1||~3.0||~4.0",
- "symfony/class-loader": "~2.1||~3.0",
"psr/container": "^1.0",
"container-interop/container-interop": "^1.2"
},
From 317631d7475bbbd0e4e3bd6da741de5a1d588b7c Mon Sep 17 00:00:00 2001
From: Samuel NELA
Date: Tue, 28 Aug 2018 14:44:34 +0200
Subject: [PATCH 153/567] Change specification for autoloading classes
---
composer.json | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/composer.json b/composer.json
index dfb31dc41..ef899943e 100644
--- a/composer.json
+++ b/composer.json
@@ -35,12 +35,18 @@
},
"autoload": {
- "psr-0": {
- "Behat\\Behat": "src/",
- "Behat\\Testwork": "src/"
+ "psr-4": {
+ "Behat\\Behat\\": "src/Behat/Behat/",
+ "Behat\\Testwork\\": "src/Behat/Testwork/"
}
},
-
+
+ "autoload-dev": {
+ "psr-4": {
+ "Behat\\Tests\\": "tests/"
+ }
+ },
+
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
From 28ffdf9ba878a986dbef4461c3b0d8282e6fa5e0 Mon Sep 17 00:00:00 2001
From: getsolaris
Date: Sun, 23 Dec 2018 20:56:40 +0900
Subject: [PATCH 154/567] Added kor lang
---
i18n.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/i18n.php b/i18n.php
index 44eda3c91..19aeabd81 100644
--- a/i18n.php
+++ b/i18n.php
@@ -214,4 +214,20 @@
'undefined_count' => '{1,21,31} %1% не определен|]1,Inf] %1% не определено',
'skipped_count' => '{1,21,31} %1% пропущен|]1,Inf] %1% пропущено',
),
+ 'ko' => array(
+ 'snippet_proposal_title' => '%1% ì •ì˜ê°€ ë˜ì§€ 않았습니다. ìŠ¤ë‹ˆíŽ«ì„ ìƒì„±í• 컨í…스트를 ì„ íƒí•˜ì‹ì‹œì˜¤:',
+ 'snippet_missing_title' => '%1% 단계가 누ë½ë˜ì—ˆìŠµë‹ˆë‹¤. ìŠ¤ë‹ˆíŽ«ì„ ì •ì˜í•´ì£¼ì„¸ìš”:',
+ 'skipped_scenarios_title' => '건너뛴 시나리오:',
+ 'failed_scenarios_title' => '실패한 시나리오:',
+ 'failed_hooks_title' => '실패한 훅 연결:',
+ 'failed_steps_title' => '실패한 단계:',
+ 'pending_steps_title' => 'ì¤€ë¹„ì¤‘ì¸ ë‹¨ê³„:',
+ 'scenarios_count' => '{0} 없는 시나리오들|{1} 1 시나리오|]1,Inf] %1% 시나리오들',
+ 'steps_count' => '{0} 없는 단계들|{1} 1 단계|]1,Inf] %1% 단계들',
+ 'passed_count' => '[1,Inf] %1% 통과',
+ 'failed_count' => '[1,Inf] %1% 실패',
+ 'pending_count' => '[1,Inf] %1% 준비중',
+ 'undefined_count' => '[1,Inf] %1% ì •ì˜ë˜ì§€ 않았습니다.',
+ 'skipped_count' => '[1,Inf] %1% 건너뜀',
+ ),
);
From ea2b9fdb7513ac6194d9cacfbccd70594f4f1335 Mon Sep 17 00:00:00 2001
From: Tibor Kotosz
Date: Thu, 7 Mar 2019 08:47:11 +0100
Subject: [PATCH 155/567] Update composer package description
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index ef899943e..9376aa798 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
{
"name": "behat/behat",
- "description": "Scenario-oriented BDD framework for PHP 5.3",
+ "description": "Scenario-oriented BDD framework for PHP",
"keywords": ["BDD", "ScenarioBDD", "StoryBDD", "Examples", "Scrum", "Agile", "User story", "Symfony", "business", "development", "testing", "documentation"],
"homepage": "http://behat.org/",
"type": "library",
From db965afb25125d9aa05fb90d6afbcde1ad9cb43a Mon Sep 17 00:00:00 2001
From: Witold Wasiczko
Date: Mon, 24 Jun 2019 13:56:26 +0200
Subject: [PATCH 156/567] PHP 7.3 support
---
.travis.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index ba30bbf04..d38706a38 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: php
-php: [5.6, 7.0, 7.1, 7.2]
+php: [5.6, 7.0, 7.1, 7.2, 7.3]
sudo: false
@@ -22,6 +22,8 @@ matrix:
env: SYMFONY_VERSION='2.8.*'
- php: 7.2
env: SYMFONY_VERSION='^3.4'
+ - php: 7.3
+ env: SYMFONY_VERSION='^3.4'
before_install:
- phpenv config-rm xdebug.ini
From 137a7efdc1ce6254fe005c27925a7f1cd79e3372 Mon Sep 17 00:00:00 2001
From: Witold Wasiczko
Date: Wed, 26 Jun 2019 23:37:13 +0200
Subject: [PATCH 157/567] Test symfony 4.2
---
.travis.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index d38706a38..65d848211 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,8 @@ matrix:
env: SYMFONY_VERSION='^3.4'
- php: 7.3
env: SYMFONY_VERSION='^3.4'
+ - php: 7.3
+ env: SYMFONY_VERSION='^4.2'
before_install:
- phpenv config-rm xdebug.ini
From dae534f705bcd58f5382949d0fe15f90db2be5ce Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Sun, 11 Aug 2019 09:31:17 +0000
Subject: [PATCH 158/567] Fix tests with the latest version of gherkin
---
composer.json | 2 +-
features/syntax_help.feature | 20 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/composer.json b/composer.json
index ef899943e..43ea18de5 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
"require": {
"php": ">=5.3.3",
"ext-mbstring": "*",
- "behat/gherkin": "^4.5.1",
+ "behat/gherkin": "^4.6.0",
"behat/transliterator": "^1.2",
"symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3",
"symfony/config": "~2.3||~3.0||~4.0",
diff --git a/features/syntax_help.feature b/features/syntax_help.feature
index caf9d8006..d0027901e 100644
--- a/features/syntax_help.feature
+++ b/features/syntax_help.feature
@@ -20,7 +20,7 @@ Feature: Syntax helpers
[Given|*] there is agent A
[And|*] there is agent B
- Scenario: Erasing agent memory
+ [Scenario|Example]: Erasing agent memory
[Given|*] there is agent J
[And|*] there is agent K
[When|*] I erase agent K's memory
@@ -54,22 +54,22 @@ Feature: Syntax helpers
We need to be able to erase past agents' memory
[ПредыÑториÑ|КонтекÑÑ‚]:
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent A
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent A
[К тому же|Также|*|И] there is agent B
- Сценарий: Erasing agent memory
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent J
+ [Сценарий|Пример]: Erasing agent memory
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent J
[К тому же|Также|*|И] there is agent K
- [Когда|*] I erase agent K's memory
+ [Когда|ЕÑли|*] I erase agent K's memory
[Затем|Тогда|То|*] there should be agent J
- [Ðо|*|Ð] there should not be agent K
+ [Иначе|Ðо|*|Ð] there should not be agent K
Структура ÑценариÑ: Erasing other agents' memory
- [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|ЕÑли|*] there is agent
+ [ДопуÑтим|ПуÑÑ‚ÑŒ|Дано|*] there is agent
[К тому же|Также|*|И] there is agent
- [Когда|*] I erase agent 's memory
+ [Когда|ЕÑли|*] I erase agent 's memory
[Затем|Тогда|То|*] there should be agent
- [Ðо|*|Ð] there should not be agent
+ [Иначе|Ðо|*|Ð] there should not be agent
Примеры:
| agent1 | agent2 |
@@ -399,6 +399,6 @@ Feature: Syntax helpers
When I run "behat --no-colors --lang=ru -d 'нашел'"
Then the output should contain:
"""
- default | [Когда|*] /^Я нашел (\d+) Ñблоко?$/
+ default | [Когда|ЕÑли|*] /^Я нашел (\d+) Ñблоко?$/
| at `FeatureContext::iFoundApples()`
"""
From 5ec7ceb1aa7e0d98402724afd271cea80220411e Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Sun, 11 Aug 2019 09:39:33 +0000
Subject: [PATCH 159/567] Use the locally installed phpunit version on travis
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index ba30bbf04..edd90370a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,7 +34,7 @@ before_script:
- echo " php_version_tags.php
script:
- - phpunit
+ - ./vendor/bin/phpunit
- behat -fprogress --strict --tags '~@php-version,'`php php_version_tags.php`
before_deploy:
From 69a9147ea274d17d0ba460b34771ae503b5ab23c Mon Sep 17 00:00:00 2001
From: Pieter Frenssen
Date: Tue, 24 Sep 2019 20:43:11 +0300
Subject: [PATCH 160/567] The PHP DOM extension is required
I'm getting the following error when running a test scenario on a minimal Ubuntu Bionic image:
```
Fatal error: Class 'DOMDocument' not found (Behat\Testwork\Call\Exception\FatalThrowableError)
```
It is thrown in `Behat\Testwork\Output\Printer\JUnitOutputPrinter`.
---
composer.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/composer.json b/composer.json
index 43ea18de5..0f2331a33 100644
--- a/composer.json
+++ b/composer.json
@@ -15,6 +15,7 @@
"require": {
"php": ">=5.3.3",
+ "ext-dom": "*",
"ext-mbstring": "*",
"behat/gherkin": "^4.6.0",
"behat/transliterator": "^1.2",
From 857fda364155841529a9671a64a7f0dea91ca248 Mon Sep 17 00:00:00 2001
From: Pieter Frenssen
Date: Wed, 25 Sep 2019 00:36:53 +0300
Subject: [PATCH 161/567] Suggest to install the DOM extension when using JUnit
output printer.
---
composer.json | 5 ++++-
src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 0f2331a33..2246d04e1 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,6 @@
"require": {
"php": ">=5.3.3",
- "ext-dom": "*",
"ext-mbstring": "*",
"behat/gherkin": "^4.6.0",
"behat/transliterator": "^1.2",
@@ -35,6 +34,10 @@
"herrera-io/box": "~1.6.1"
},
+ "suggest": {
+ "ext-dom": "Needed to output test results in JUnit format."
+ },
+
"autoload": {
"psr-4": {
"Behat\\Behat\\": "src/Behat/Behat/",
diff --git a/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php b/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
index 7577e111c..ec491108f 100644
--- a/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
+++ b/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
@@ -57,6 +57,10 @@ public function __construct(FilesystemOutputFactory $outputFactory)
*/
public function createNewFile($name, array $testsuitesAttributes = array())
{
+ // This requires the DOM extension to be enabled.
+ if (!extension_loaded('dom')) {
+ throw new \Exception('The PHP DOM extension is required to generate JUnit reports.');
+ }
$this->setFileName(strtolower(trim(preg_replace('/[^[:alnum:]_]+/', '_', $name), '_')));
$this->domDocument = new \DOMDocument(self::XML_VERSION, self::XML_ENCODING);
From 5b3939009aa8fcac39c449abc217a7c2cc45950f Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Mon, 30 Sep 2019 08:52:02 +0100
Subject: [PATCH 162/567] Disable XDebug if it is enabled
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index a7c0c7115..1dc30050e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,7 +28,7 @@ matrix:
env: SYMFONY_VERSION='^4.2'
before_install:
- - phpenv config-rm xdebug.ini
+ - phpenv config-rm xdebug.ini || echo "XDebug is not enabled"
before_script:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
From 2eedfc4b8de66b200d6e921ac9e0c6d22240ada2 Mon Sep 17 00:00:00 2001
From: Witold Wasiczko
Date: Mon, 24 Jun 2019 14:00:01 +0200
Subject: [PATCH 163/567] Boolean -> boolean
---
.../Context/Cli/InteractiveContextIdentifier.php | 2 +-
.../Context/ContextClass/ClassGenerator.php | 2 +-
.../Behat/Context/ContextClass/ClassResolver.php | 2 +-
.../Context/Environment/ContextEnvironment.php | 4 ++--
.../Context/Reader/AnnotatedContextReader.php | 6 +++---
.../Snippet/Appender/ContextSnippetAppender.php | 2 +-
.../Definition/Pattern/Policy/PatternPolicy.php | 4 ++--
src/Behat/Behat/Definition/SearchResult.php | 2 +-
.../EventDispatcher/Event/AfterStepSetup.php | 2 +-
.../EventDispatcher/Event/AfterStepTested.php | 8 ++++----
.../EventDispatcher/Event/BeforeStepTeardown.php | 6 +++---
.../Gherkin/Suite/Setup/SuiteWithPathsSetup.php | 2 +-
src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php | 6 +++---
.../Behat/Hook/Call/RuntimeScenarioHook.php | 6 +++---
src/Behat/Behat/Hook/Call/RuntimeStepHook.php | 2 +-
.../EventListener/AST/OutlineTableListener.php | 2 +-
.../Flow/FireOnlySiblingsListener.php | 2 +-
.../Flow/FirstBackgroundFiresFirstListener.php | 4 ++--
.../Flow/OnlyFirstBackgroundFiresListener.php | 16 ++++++++--------
.../Node/Printer/Pretty/PrettySetupPrinter.php | 4 ++--
.../Printer/Pretty/PrettySkippedStepPrinter.php | 2 +-
.../Node/Printer/Pretty/PrettyStepPrinter.php | 2 +-
.../Behat/Snippet/Appender/SnippetAppender.php | 2 +-
.../Behat/Snippet/Generator/SnippetGenerator.php | 2 +-
src/Behat/Behat/Snippet/SnippetRegistry.php | 2 +-
src/Behat/Behat/Tester/BackgroundTester.php | 6 +++---
src/Behat/Behat/Tester/OutlineTester.php | 6 +++---
.../Tester/Runtime/RuntimeScenarioTester.php | 2 +-
.../Behat/Tester/Runtime/RuntimeStepTester.php | 2 +-
src/Behat/Behat/Tester/ScenarioTester.php | 6 +++---
src/Behat/Behat/Tester/StepContainerTester.php | 2 +-
src/Behat/Behat/Tester/StepTester.php | 6 +++---
.../SimpleArgumentTransformation.php | 2 +-
.../Transformer/ArgumentTransformer.php | 2 +-
.../Testwork/Argument/MixedArgumentOrganiser.php | 8 ++++----
.../Argument/PregMatchArgumentOrganiser.php | 2 +-
src/Behat/Testwork/Call/CallResult.php | 4 ++--
src/Behat/Testwork/Call/CallResults.php | 4 ++--
src/Behat/Testwork/Call/Callee.php | 4 ++--
src/Behat/Testwork/Call/Filter/CallFilter.php | 2 +-
src/Behat/Testwork/Call/Filter/ResultFilter.php | 2 +-
src/Behat/Testwork/Call/Handler/CallHandler.php | 2 +-
.../Testwork/Call/Handler/RuntimeCallHandler.php | 4 ++--
src/Behat/Testwork/Call/RuntimeCallee.php | 4 ++--
.../Environment/Handler/EnvironmentHandler.php | 4 ++--
.../Environment/Reader/EnvironmentReader.php | 2 +-
.../Exception/Stringer/ExceptionStringer.php | 2 +-
.../Testwork/Hook/Call/RuntimeSuiteHook.php | 2 +-
src/Behat/Testwork/Hook/FilterableHook.php | 2 +-
src/Behat/Testwork/Ordering/OrderedExercise.php | 6 +++---
.../Testwork/Output/Cli/OutputController.php | 6 +++---
src/Behat/Testwork/Output/OutputManager.php | 2 +-
.../Output/Printer/Factory/OutputFactory.php | 2 +-
.../Testwork/Output/Printer/OutputPrinter.php | 2 +-
.../Configuration/ConfigurationLoader.php | 2 +-
.../Testwork/Suite/Generator/SuiteGenerator.php | 2 +-
src/Behat/Testwork/Suite/GenericSuite.php | 2 +-
src/Behat/Testwork/Suite/Setup/SuiteSetup.php | 2 +-
src/Behat/Testwork/Suite/Suite.php | 2 +-
src/Behat/Testwork/Suite/SuiteRegistry.php | 2 +-
.../Testwork/Tester/Cli/ExerciseController.php | 4 ++--
.../Testwork/Tester/Cli/StrictController.php | 4 ++--
src/Behat/Testwork/Tester/Exercise.php | 6 +++---
.../Testwork/Tester/Result/ExceptionResult.php | 2 +-
.../Interpretation/ResultInterpretation.php | 2 +-
src/Behat/Testwork/Tester/Result/TestResult.php | 2 +-
.../Tester/ServiceContainer/TesterExtension.php | 4 ++--
src/Behat/Testwork/Tester/Setup/Setup.php | 4 ++--
src/Behat/Testwork/Tester/Setup/Teardown.php | 4 ++--
.../Testwork/Tester/SpecificationTester.php | 6 +++---
src/Behat/Testwork/Tester/SuiteTester.php | 6 +++---
71 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 52a3eb934..286ffde12 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -98,7 +98,7 @@ private function askQuestion($message, $choices, $default)
/**
* Checks if interactive mode is supported.
*
- * @return Boolean
+ * @return boolean
*
* @deprecated there is a better way to do it - `InputInterface::isInteractive()` method.
* Sadly, this doesn't work properly prior Symfony\Console 2.7 and as we need
diff --git a/src/Behat/Behat/Context/ContextClass/ClassGenerator.php b/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
index d2a740926..61b3fc1d8 100644
--- a/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
+++ b/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
@@ -28,7 +28,7 @@ interface ClassGenerator
* @param Suite $suite
* @param string $contextClass
*
- * @return Boolean
+ * @return boolean
*/
public function supportsSuiteAndClass(Suite $suite, $contextClass);
diff --git a/src/Behat/Behat/Context/ContextClass/ClassResolver.php b/src/Behat/Behat/Context/ContextClass/ClassResolver.php
index 464f68f41..a97680ee6 100644
--- a/src/Behat/Behat/Context/ContextClass/ClassResolver.php
+++ b/src/Behat/Behat/Context/ContextClass/ClassResolver.php
@@ -26,7 +26,7 @@ interface ClassResolver
*
* @param string $contextString
*
- * @return Boolean
+ * @return boolean
*/
public function supportsClass($contextString);
diff --git a/src/Behat/Behat/Context/Environment/ContextEnvironment.php b/src/Behat/Behat/Context/Environment/ContextEnvironment.php
index 690eebb28..90acc4db3 100644
--- a/src/Behat/Behat/Context/Environment/ContextEnvironment.php
+++ b/src/Behat/Behat/Context/Environment/ContextEnvironment.php
@@ -25,7 +25,7 @@ interface ContextEnvironment extends Environment
/**
* Checks if environment has any contexts registered.
*
- * @return Boolean
+ * @return boolean
*/
public function hasContexts();
@@ -41,7 +41,7 @@ public function getContextClasses();
*
* @param string $class
*
- * @return Boolean
+ * @return boolean
*/
public function hasContextClass($class);
}
diff --git a/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
index a3144740e..722473f1c 100644
--- a/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
+++ b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
@@ -180,7 +180,7 @@ private function readDescription($docBlock)
*
* @param string $docLine
*
- * @return Boolean
+ * @return boolean
*/
private function isEmpty($docLine)
{
@@ -192,7 +192,7 @@ private function isEmpty($docLine)
*
* @param string $docLine
*
- * @return Boolean
+ * @return boolean
*/
private function isNotAnnotation($docLine)
{
@@ -229,7 +229,7 @@ private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $
*
* @param string $docLine
*
- * @return Boolean
+ * @return boolean
*/
private function isIgnoredAnnotation($docLine)
{
diff --git a/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php b/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
index 5a881f94b..7af719c36 100644
--- a/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
+++ b/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
@@ -81,7 +81,7 @@ public function appendSnippet(AggregateSnippet $snippet)
* @param string $class
* @param string $contextFileContent
*
- * @return Boolean
+ * @return boolean
*/
private function isClassImported($class, $contextFileContent)
{
diff --git a/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php b/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
index 247624170..cbad76e50 100644
--- a/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
+++ b/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
@@ -27,7 +27,7 @@ interface PatternPolicy
*
* @param string $type
*
- * @return Boolean
+ * @return boolean
*/
public function supportsPatternType($type);
@@ -45,7 +45,7 @@ public function generatePattern($stepText);
*
* @param string $pattern
*
- * @return Boolean
+ * @return boolean
*/
public function supportsPattern($pattern);
diff --git a/src/Behat/Behat/Definition/SearchResult.php b/src/Behat/Behat/Definition/SearchResult.php
index 158f63557..512d6c24c 100644
--- a/src/Behat/Behat/Definition/SearchResult.php
+++ b/src/Behat/Behat/Definition/SearchResult.php
@@ -47,7 +47,7 @@ public function __construct(Definition $definition = null, $matchedText = null,
/**
* Checks if result contains a match.
*
- * @return Boolean
+ * @return boolean
*/
public function hasMatch()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php b/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
index cf9b6c5f5..9eb520fa1 100644
--- a/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
+++ b/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
@@ -86,7 +86,7 @@ public function getSetup()
/**
* Checks if step call, setup or teardown produced any output (stdOut or exception).
*
- * @return Boolean
+ * @return boolean
*/
public function hasOutput()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php b/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
index 37b497bfa..7ddcd9bdc 100644
--- a/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
+++ b/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
@@ -111,7 +111,7 @@ public function getTeardown()
/**
* Checks if step call, setup or teardown produced any output (stdOut or exception).
*
- * @return Boolean
+ * @return boolean
*/
public function hasOutput()
{
@@ -121,7 +121,7 @@ public function hasOutput()
/**
* Checks if step teardown has output.
*
- * @return Boolean
+ * @return boolean
*/
private function teardownHasOutput()
{
@@ -131,7 +131,7 @@ private function teardownHasOutput()
/**
* Checks if result has produced exception.
*
- * @return Boolean
+ * @return boolean
*/
private function resultHasException()
{
@@ -141,7 +141,7 @@ private function resultHasException()
/**
* Checks if result is executed and call result has produced exception or stdOut.
*
- * @return Boolean
+ * @return boolean
*/
private function resultCallHasOutput()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php b/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
index 6d9b9c6e9..4bb296ec2 100644
--- a/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
+++ b/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
@@ -93,7 +93,7 @@ public function getTestResult()
/**
* Checks if step call produced any output (stdOut or exception).
*
- * @return Boolean
+ * @return boolean
*/
public function hasOutput()
{
@@ -103,7 +103,7 @@ public function hasOutput()
/**
* Checks if result has produced exception.
*
- * @return Boolean
+ * @return boolean
*/
private function resultHasException()
{
@@ -113,7 +113,7 @@ private function resultHasException()
/**
* Checks if result is executed and call result has produced exception or stdOut.
*
- * @return Boolean
+ * @return boolean
*/
private function resultCallHasOutput()
{
diff --git a/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
index 65c7c8f73..5147d4f11 100644
--- a/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
+++ b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
@@ -97,7 +97,7 @@ private function locatePath($path)
*
* @param string $file A file path
*
- * @return Boolean
+ * @return boolean
*/
private function isAbsolutePath($file)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
index b3d4fb24b..8b3ca5348 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
@@ -68,7 +68,7 @@ public function filterMatches(HookScope $scope)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
private function isMatch(FeatureNode $feature, $filterString)
{
@@ -89,7 +89,7 @@ private function isMatch(FeatureNode $feature, $filterString)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
private function isMatchTagFilter(FeatureNode $feature, $filterString)
{
@@ -104,7 +104,7 @@ private function isMatchTagFilter(FeatureNode $feature, $filterString)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
private function isMatchNameFilter(FeatureNode $feature, $filterString)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
index 56e25f999..9bb6bbb8c 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
@@ -48,7 +48,7 @@ public function filterMatches(HookScope $scope)
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
{
@@ -70,7 +70,7 @@ protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $f
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
{
@@ -89,7 +89,7 @@ protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $sce
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeStepHook.php b/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
index a1326c3cf..57ea7641b 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
@@ -55,7 +55,7 @@ public function filterMatches(HookScope $scope)
* @param StepNode $step
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
private function isStepMatch(StepNode $step, $filterString)
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
index fa77da454..490dfbbb5 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
@@ -61,7 +61,7 @@ final class OutlineTableListener implements EventListener
*/
private $exampleSetup;
/**
- * @var Boolean
+ * @var boolean
*/
private $headerPrinted = false;
/**
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
index 7e5788554..44db35bb8 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
@@ -37,7 +37,7 @@ class FireOnlySiblingsListener implements EventListener
*/
private $descendant;
/**
- * @var Boolean
+ * @var boolean
*/
private $inContext = false;
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
index f9bb95f64..b63824d6a 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
@@ -34,7 +34,7 @@ class FirstBackgroundFiresFirstListener implements EventListener
*/
private $descendant;
/**
- * @var Boolean
+ * @var boolean
*/
private $firstBackgroundEnded = false;
/**
@@ -103,7 +103,7 @@ private function markFirstBackgroundPrintedAfterBackground($eventName)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event)
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
index ad3679c8f..4a0278c06 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
@@ -36,15 +36,15 @@ class OnlyFirstBackgroundFiresListener implements EventListener
*/
private $descendant;
/**
- * @var Boolean
+ * @var boolean
*/
private $firstBackgroundEnded = false;
/**
- * @var Boolean
+ * @var boolean
*/
private $inBackground = false;
/**
- * @var Boolean
+ * @var boolean
*/
private $stepSetupHadOutput = false;
@@ -125,7 +125,7 @@ private function markFirstBackgroundPrintedAfterBackground($eventName)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isSkippableEvent(Event $event)
{
@@ -141,7 +141,7 @@ private function isSkippableEvent(Event $event)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isNonFailingConsequentBackgroundStep(Event $event)
{
@@ -157,7 +157,7 @@ private function isNonFailingConsequentBackgroundStep(Event $event)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isStepEventWithOutput(Event $event)
{
@@ -169,7 +169,7 @@ private function isStepEventWithOutput(Event $event)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isBeforeStepEventWithOutput(Event $event)
{
@@ -187,7 +187,7 @@ private function isBeforeStepEventWithOutput(Event $event)
*
* @param Event $event
*
- * @return Boolean
+ * @return boolean
*/
private function isAfterStepWithOutput(Event $event)
{
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
index 46bcba3a3..09e900788 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
@@ -56,8 +56,8 @@ final class PrettySetupPrinter implements SetupPrinter
* @param ResultToStringConverter $resultConverter
* @param ExceptionPresenter $exceptionPresenter
* @param integer $indentation
- * @param Boolean $newlineBefore
- * @param Boolean $newlineAfter
+ * @param boolean $newlineBefore
+ * @param boolean $newlineAfter
*/
public function __construct(
ResultToStringConverter $resultConverter,
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
index 718afd3b9..2ec682556 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
@@ -129,7 +129,7 @@ private function printArguments(Formatter $formatter, array $arguments)
* Returns argument string for provided argument.
*
* @param ArgumentInterface $argument
- * @param Boolean $collapse
+ * @param boolean $collapse
*
* @return string
*/
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
index 8d47da1ec..9604c1021 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
@@ -180,7 +180,7 @@ private function printException(OutputPrinter $printer, StepResult $result)
* Returns argument string for provided argument.
*
* @param ArgumentInterface $argument
- * @param Boolean $collapse
+ * @param boolean $collapse
*
* @return string
*/
diff --git a/src/Behat/Behat/Snippet/Appender/SnippetAppender.php b/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
index 041b8e6e5..e78d6bea4 100644
--- a/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
+++ b/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
@@ -27,7 +27,7 @@ interface SnippetAppender
*
* @param AggregateSnippet $snippet
*
- * @return Boolean
+ * @return boolean
*/
public function supportsSnippet(AggregateSnippet $snippet);
diff --git a/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php b/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
index ca7d73937..5e68af1fe 100644
--- a/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
+++ b/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
@@ -30,7 +30,7 @@ interface SnippetGenerator
* @param Environment $environment
* @param StepNode $step
*
- * @return Boolean
+ * @return boolean
*/
public function supportsEnvironmentAndStep(Environment $environment, StepNode $step);
diff --git a/src/Behat/Behat/Snippet/SnippetRegistry.php b/src/Behat/Behat/Snippet/SnippetRegistry.php
index 0724c3e40..6bdbbebf7 100644
--- a/src/Behat/Behat/Snippet/SnippetRegistry.php
+++ b/src/Behat/Behat/Snippet/SnippetRegistry.php
@@ -34,7 +34,7 @@ final class SnippetRegistry implements SnippetRepository
*/
private $snippets = array();
/**
- * @var Boolean
+ * @var boolean
*/
private $snippetsGenerated = false;
diff --git a/src/Behat/Behat/Tester/BackgroundTester.php b/src/Behat/Behat/Tester/BackgroundTester.php
index 8d70b57d8..4a8c823ec 100644
--- a/src/Behat/Behat/Tester/BackgroundTester.php
+++ b/src/Behat/Behat/Tester/BackgroundTester.php
@@ -28,7 +28,7 @@ interface BackgroundTester
*
* @param Environment $env
* @param FeatureNode $feature
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -39,7 +39,7 @@ public function setUp(Environment $env, FeatureNode $feature, $skip);
*
* @param Environment $env
* @param FeatureNode $feature
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -50,7 +50,7 @@ public function test(Environment $env, FeatureNode $feature, $skip);
*
* @param Environment $env
* @param FeatureNode $feature
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/OutlineTester.php b/src/Behat/Behat/Tester/OutlineTester.php
index 863aba38c..144f1caf4 100644
--- a/src/Behat/Behat/Tester/OutlineTester.php
+++ b/src/Behat/Behat/Tester/OutlineTester.php
@@ -30,7 +30,7 @@ interface OutlineTester
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outli
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, OutlineNode $outlin
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php b/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
index 7ab11a0be..47ec35f1b 100644
--- a/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
+++ b/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
@@ -91,7 +91,7 @@ public function tearDown(Environment $env, FeatureNode $feature, Scenario $scena
*
* @param Environment $env
* @param FeatureNode $feature
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
diff --git a/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php b/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
index 7031eeca7..82e76c144 100644
--- a/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
+++ b/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
@@ -107,7 +107,7 @@ private function searchDefinition(Environment $env, FeatureNode $feature, StepNo
* @param FeatureNode $feature
* @param StepNode $step
* @param SearchResult $search
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return StepResult
*/
diff --git a/src/Behat/Behat/Tester/ScenarioTester.php b/src/Behat/Behat/Tester/ScenarioTester.php
index 2fd249489..ae3baef5e 100644
--- a/src/Behat/Behat/Tester/ScenarioTester.php
+++ b/src/Behat/Behat/Tester/ScenarioTester.php
@@ -30,7 +30,7 @@ interface ScenarioTester
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, Scenario $scenario,
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/StepContainerTester.php b/src/Behat/Behat/Tester/StepContainerTester.php
index 543e133d2..a78ac1003 100644
--- a/src/Behat/Behat/Tester/StepContainerTester.php
+++ b/src/Behat/Behat/Tester/StepContainerTester.php
@@ -45,7 +45,7 @@ public function __construct(StepTester $stepTester)
* @param Environment $env
* @param FeatureNode $feature
* @param StepContainerInterface $container
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult[]
*/
diff --git a/src/Behat/Behat/Tester/StepTester.php b/src/Behat/Behat/Tester/StepTester.php
index d5c995ceb..7ffd7b35b 100644
--- a/src/Behat/Behat/Tester/StepTester.php
+++ b/src/Behat/Behat/Tester/StepTester.php
@@ -30,7 +30,7 @@ interface StepTester
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $s
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return StepResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, StepNode $step, $sk
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param Boolean $skip
+ * @param boolean $skip
* @param StepResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php b/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
index 77cdeefb2..c8a71a6e4 100644
--- a/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
+++ b/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
@@ -45,7 +45,7 @@ public function getPriority();
* @param integer|string $argumentIndex
* @param mixed $argumentValue
*
- * @return Boolean
+ * @return boolean
*/
public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue);
diff --git a/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php b/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
index 4773960e0..f49be2dcd 100644
--- a/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
+++ b/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
@@ -26,7 +26,7 @@ interface ArgumentTransformer
* @param integer|string $argumentIndex
* @param mixed $argumentValue
*
- * @return Boolean
+ * @return boolean
*/
public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue);
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index c845f03d4..d21e8bd5d 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -99,7 +99,7 @@ function (ReflectionParameter $parameter) {
* @param mixed $argumentKey
* @param string[] $parameterNames
*
- * @return Boolean
+ * @return boolean
*/
private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
{
@@ -112,7 +112,7 @@ private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
* @param ReflectionParameter[] $parameters
* @param mixed $value
*
- * @return Boolean
+ * @return boolean
*/
private function isParameterTypehintedInArgumentList(array $parameters, $value)
{
@@ -135,7 +135,7 @@ private function isParameterTypehintedInArgumentList(array $parameters, $value)
* @param object $value
* @param ReflectionParameter $parameter
*
- * @return Boolean
+ * @return boolean
*/
private function isValueMatchesTypehintedParameter($value, ReflectionParameter $parameter)
{
@@ -425,7 +425,7 @@ private function markArgumentDefined($position)
*
* @param integer $position
*
- * @return Boolean
+ * @return boolean
*/
private function isArgumentDefined($position)
{
diff --git a/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php b/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
index 2fb053585..a49d3920a 100644
--- a/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
@@ -81,7 +81,7 @@ private function cleanupMatchDuplicates(array $match)
* @param integer $keyIndex
* @param mixed[] $keys
*
- * @return Boolean
+ * @return boolean
*/
private function isKeyAStringAndNexOneIsAnInteger($keyIndex, array $keys)
{
diff --git a/src/Behat/Testwork/Call/CallResult.php b/src/Behat/Testwork/Call/CallResult.php
index ca3c52837..6bb4c69ec 100644
--- a/src/Behat/Testwork/Call/CallResult.php
+++ b/src/Behat/Testwork/Call/CallResult.php
@@ -75,7 +75,7 @@ public function getReturn()
/**
* Check if call thrown exception.
*
- * @return Boolean
+ * @return boolean
*/
public function hasException()
{
@@ -95,7 +95,7 @@ public function getException()
/**
* Checks if call produced stdOut.
*
- * @return Boolean
+ * @return boolean
*/
public function hasStdOut()
{
diff --git a/src/Behat/Testwork/Call/CallResults.php b/src/Behat/Testwork/Call/CallResults.php
index f79ea0c9e..bd0048872 100644
--- a/src/Behat/Testwork/Call/CallResults.php
+++ b/src/Behat/Testwork/Call/CallResults.php
@@ -53,7 +53,7 @@ public static function merge(CallResults $first, CallResults $second)
/**
* Checks if any call in collection throws an exception.
*
- * @return Boolean
+ * @return boolean
*/
public function hasExceptions()
{
@@ -69,7 +69,7 @@ public function hasExceptions()
/**
* Checks if any call in collection produces an output.
*
- * @return Boolean
+ * @return boolean
*/
public function hasStdOuts()
{
diff --git a/src/Behat/Testwork/Call/Callee.php b/src/Behat/Testwork/Call/Callee.php
index c03e77649..240d8d5c1 100644
--- a/src/Behat/Testwork/Call/Callee.php
+++ b/src/Behat/Testwork/Call/Callee.php
@@ -36,14 +36,14 @@ public function getDescription();
/**
* Returns true if callee is a method, false otherwise.
*
- * @return Boolean
+ * @return boolean
*/
public function isAMethod();
/**
* Returns true if callee is an instance (non-static) method, false otherwise.
*
- * @return Boolean
+ * @return boolean
*/
public function isAnInstanceMethod();
diff --git a/src/Behat/Testwork/Call/Filter/CallFilter.php b/src/Behat/Testwork/Call/Filter/CallFilter.php
index 5426c160a..7565d8af2 100644
--- a/src/Behat/Testwork/Call/Filter/CallFilter.php
+++ b/src/Behat/Testwork/Call/Filter/CallFilter.php
@@ -27,7 +27,7 @@ interface CallFilter
*
* @param Call $call
*
- * @return Boolean
+ * @return boolean
*/
public function supportsCall(Call $call);
diff --git a/src/Behat/Testwork/Call/Filter/ResultFilter.php b/src/Behat/Testwork/Call/Filter/ResultFilter.php
index ac3ebe000..66dabef18 100644
--- a/src/Behat/Testwork/Call/Filter/ResultFilter.php
+++ b/src/Behat/Testwork/Call/Filter/ResultFilter.php
@@ -27,7 +27,7 @@ interface ResultFilter
*
* @param CallResult $result
*
- * @return Boolean
+ * @return boolean
*/
public function supportsResult(CallResult $result);
diff --git a/src/Behat/Testwork/Call/Handler/CallHandler.php b/src/Behat/Testwork/Call/Handler/CallHandler.php
index e553d2a76..78c6df57b 100644
--- a/src/Behat/Testwork/Call/Handler/CallHandler.php
+++ b/src/Behat/Testwork/Call/Handler/CallHandler.php
@@ -28,7 +28,7 @@ interface CallHandler
*
* @param Call $call
*
- * @return Boolean
+ * @return boolean
*/
public function supportsCall(Call $call);
diff --git a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
index 62b3d1d6d..8f09a406f 100644
--- a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
+++ b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
@@ -77,7 +77,7 @@ public function handleCall(Call $call)
* @param string $file
* @param integer $line
*
- * @return Boolean
+ * @return boolean
*
* @throws CallErrorException
*/
@@ -154,7 +154,7 @@ private function stopErrorAndOutputBuffering()
*
* @param integer $level
*
- * @return Boolean
+ * @return boolean
*/
private function errorLevelIsNotReportable($level)
{
diff --git a/src/Behat/Testwork/Call/RuntimeCallee.php b/src/Behat/Testwork/Call/RuntimeCallee.php
index c764629d2..710697a82 100644
--- a/src/Behat/Testwork/Call/RuntimeCallee.php
+++ b/src/Behat/Testwork/Call/RuntimeCallee.php
@@ -112,7 +112,7 @@ public function getReflection()
/**
* Returns true if callee is a method, false otherwise.
*
- * @return Boolean
+ * @return boolean
*/
public function isAMethod()
{
@@ -122,7 +122,7 @@ public function isAMethod()
/**
* Returns true if callee is an instance (non-static) method, false otherwise.
*
- * @return Boolean
+ * @return boolean
*/
public function isAnInstanceMethod()
{
diff --git a/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php b/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
index f2b6b9820..062de8f78 100644
--- a/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
+++ b/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
@@ -28,7 +28,7 @@ interface EnvironmentHandler
*
* @param Suite $suite
*
- * @return Boolean
+ * @return boolean
*/
public function supportsSuite(Suite $suite);
@@ -47,7 +47,7 @@ public function buildEnvironment(Suite $suite);
* @param Environment $environment
* @param mixed $testSubject
*
- * @return Boolean
+ * @return boolean
*/
public function supportsEnvironmentAndSubject(Environment $environment, $testSubject = null);
diff --git a/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php b/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
index dcf66fde8..9c7430d10 100644
--- a/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
+++ b/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
@@ -28,7 +28,7 @@ interface EnvironmentReader
*
* @param Environment $environment
*
- * @return Boolean
+ * @return boolean
*/
public function supportsEnvironment(Environment $environment);
diff --git a/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php b/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
index eab706186..0a302b006 100644
--- a/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
+++ b/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
@@ -27,7 +27,7 @@ interface ExceptionStringer
*
* @param Exception $exception
*
- * @return Boolean
+ * @return boolean
*/
public function supportsException(Exception $exception);
diff --git a/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php b/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
index 237bc7615..ce9269179 100644
--- a/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
+++ b/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
@@ -70,7 +70,7 @@ public function filterMatches(HookScope $scope)
* @param Suite $suite
* @param string $filterString
*
- * @return Boolean
+ * @return boolean
*/
private function isSuiteMatch(Suite $suite, $filterString)
{
diff --git a/src/Behat/Testwork/Hook/FilterableHook.php b/src/Behat/Testwork/Hook/FilterableHook.php
index 48ece6aba..42399f32a 100644
--- a/src/Behat/Testwork/Hook/FilterableHook.php
+++ b/src/Behat/Testwork/Hook/FilterableHook.php
@@ -24,7 +24,7 @@ interface FilterableHook extends Hook
*
* @param HookScope $scope
*
- * @return Boolean
+ * @return boolean
*/
public function filterMatches(HookScope $scope);
}
diff --git a/src/Behat/Testwork/Ordering/OrderedExercise.php b/src/Behat/Testwork/Ordering/OrderedExercise.php
index 1cc3055a6..8c4add8cc 100644
--- a/src/Behat/Testwork/Ordering/OrderedExercise.php
+++ b/src/Behat/Testwork/Ordering/OrderedExercise.php
@@ -58,7 +58,7 @@ public function __construct(Exercise $decoratedExercise)
* Sets up exercise for a test.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -71,7 +71,7 @@ public function setUp(array $iterators, $skip)
* Tests suites specifications.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -84,7 +84,7 @@ public function test(array $iterators, $skip)
* Tears down exercise after a test.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Output/Cli/OutputController.php b/src/Behat/Testwork/Output/Cli/OutputController.php
index ae886519b..2891f2c7e 100644
--- a/src/Behat/Testwork/Output/Cli/OutputController.php
+++ b/src/Behat/Testwork/Output/Cli/OutputController.php
@@ -153,7 +153,7 @@ protected function locateOutputPath($path)
*
* @param array $formats
* @param array $outputs
- * @param Boolean $decorated
+ * @param boolean $decorated
*/
private function configureOutputs(array $formats, array $outputs, $decorated = false)
{
@@ -184,7 +184,7 @@ private function configureOutputs(array $formats, array $outputs, $decorated = f
*
* @param string $outputId
*
- * @return Boolean
+ * @return boolean
*/
private function isStandardOutput($outputId)
{
@@ -196,7 +196,7 @@ private function isStandardOutput($outputId)
*
* @param string $file A file path
*
- * @return Boolean
+ * @return boolean
*/
private function isAbsolutePath($file)
{
diff --git a/src/Behat/Testwork/Output/OutputManager.php b/src/Behat/Testwork/Output/OutputManager.php
index cdf776018..b26dc28ee 100644
--- a/src/Behat/Testwork/Output/OutputManager.php
+++ b/src/Behat/Testwork/Output/OutputManager.php
@@ -58,7 +58,7 @@ public function registerFormatter(Formatter $formatter)
*
* @param string $name
*
- * @return Boolean
+ * @return boolean
*/
public function isFormatterRegistered($name)
{
diff --git a/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php b/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
index 20f47d35a..04b49de7e 100644
--- a/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
+++ b/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
@@ -83,7 +83,7 @@ public function getOutputStyles()
/**
* Forces output to be decorated.
*
- * @param Boolean $decorated
+ * @param boolean $decorated
*/
public function setOutputDecorated($decorated)
{
diff --git a/src/Behat/Testwork/Output/Printer/OutputPrinter.php b/src/Behat/Testwork/Output/Printer/OutputPrinter.php
index 91292d39c..c6f91a6bf 100644
--- a/src/Behat/Testwork/Output/Printer/OutputPrinter.php
+++ b/src/Behat/Testwork/Output/Printer/OutputPrinter.php
@@ -69,7 +69,7 @@ public function getOutputStyles();
/**
* Forces output to be decorated.
*
- * @param Boolean $decorated
+ * @param boolean $decorated
*/
public function setOutputDecorated($decorated);
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
index 33521c10d..5de153e88 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
@@ -29,7 +29,7 @@ final class ConfigurationLoader
*/
private $environmentVariable;
/**
- * @var Boolean
+ * @var boolean
*/
private $profileFound;
/**
diff --git a/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php b/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
index 876d6b600..a6b1c1b1d 100644
--- a/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
+++ b/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
@@ -28,7 +28,7 @@ interface SuiteGenerator
* @param string $type
* @param array $settings
*
- * @return Boolean
+ * @return boolean
*/
public function supportsTypeAndSettings($type, array $settings);
diff --git a/src/Behat/Testwork/Suite/GenericSuite.php b/src/Behat/Testwork/Suite/GenericSuite.php
index 766cffe5b..3111bc0ce 100644
--- a/src/Behat/Testwork/Suite/GenericSuite.php
+++ b/src/Behat/Testwork/Suite/GenericSuite.php
@@ -65,7 +65,7 @@ public function getSettings()
*
* @param string $key
*
- * @return Boolean
+ * @return boolean
*/
public function hasSetting($key)
{
diff --git a/src/Behat/Testwork/Suite/Setup/SuiteSetup.php b/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
index 616562434..2dc25da7f 100644
--- a/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
+++ b/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
@@ -27,7 +27,7 @@ interface SuiteSetup
*
* @param Suite $suite
*
- * @return Boolean
+ * @return boolean
*/
public function supportsSuite(Suite $suite);
diff --git a/src/Behat/Testwork/Suite/Suite.php b/src/Behat/Testwork/Suite/Suite.php
index 782f8fd7c..5f2ad3586 100644
--- a/src/Behat/Testwork/Suite/Suite.php
+++ b/src/Behat/Testwork/Suite/Suite.php
@@ -36,7 +36,7 @@ public function getSettings();
*
* @param string $key
*
- * @return Boolean
+ * @return boolean
*/
public function hasSetting($key);
diff --git a/src/Behat/Testwork/Suite/SuiteRegistry.php b/src/Behat/Testwork/Suite/SuiteRegistry.php
index 5ad98fdcb..ef708fc45 100644
--- a/src/Behat/Testwork/Suite/SuiteRegistry.php
+++ b/src/Behat/Testwork/Suite/SuiteRegistry.php
@@ -23,7 +23,7 @@
final class SuiteRegistry implements SuiteRepository
{
/**
- * @var Boolean
+ * @var boolean
*/
private $suitesGenerated = false;
/**
diff --git a/src/Behat/Testwork/Tester/Cli/ExerciseController.php b/src/Behat/Testwork/Tester/Cli/ExerciseController.php
index b3d2eac5b..e88bbfc6c 100644
--- a/src/Behat/Testwork/Tester/Cli/ExerciseController.php
+++ b/src/Behat/Testwork/Tester/Cli/ExerciseController.php
@@ -52,7 +52,7 @@ final class ExerciseController implements Controller
*/
private $resultInterpreter;
/**
- * @var Boolean
+ * @var boolean
*/
private $skip;
@@ -63,7 +63,7 @@ final class ExerciseController implements Controller
* @param SpecificationFinder $specificationFinder
* @param Exercise $exercise
* @param ResultInterpreter $resultInterpreter
- * @param Boolean $skip
+ * @param boolean $skip
*/
public function __construct(
SuiteRepository $suiteRepository,
diff --git a/src/Behat/Testwork/Tester/Cli/StrictController.php b/src/Behat/Testwork/Tester/Cli/StrictController.php
index 1e610be21..6ea5fdac5 100644
--- a/src/Behat/Testwork/Tester/Cli/StrictController.php
+++ b/src/Behat/Testwork/Tester/Cli/StrictController.php
@@ -30,7 +30,7 @@ final class StrictController implements Controller
*/
private $resultInterpreter;
/**
- * @var Boolean
+ * @var boolean
*/
private $strict;
@@ -38,7 +38,7 @@ final class StrictController implements Controller
* Initializes controller.
*
* @param ResultInterpreter $resultInterpreter
- * @param Boolean $strict
+ * @param boolean $strict
*/
public function __construct(ResultInterpreter $resultInterpreter, $strict = false)
{
diff --git a/src/Behat/Testwork/Tester/Exercise.php b/src/Behat/Testwork/Tester/Exercise.php
index 6a19c1efb..705cd7d9d 100644
--- a/src/Behat/Testwork/Tester/Exercise.php
+++ b/src/Behat/Testwork/Tester/Exercise.php
@@ -26,7 +26,7 @@ interface Exercise
* Sets up exercise for a test.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -36,7 +36,7 @@ public function setUp(array $iterators, $skip);
* Tests suites specifications.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -46,7 +46,7 @@ public function test(array $iterators, $skip);
* Tears down exercise after a test.
*
* @param SpecificationIterator[] $iterators
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Tester/Result/ExceptionResult.php b/src/Behat/Testwork/Tester/Result/ExceptionResult.php
index f30edcf19..a8d4c68d9 100644
--- a/src/Behat/Testwork/Tester/Result/ExceptionResult.php
+++ b/src/Behat/Testwork/Tester/Result/ExceptionResult.php
@@ -22,7 +22,7 @@ interface ExceptionResult extends TestResult
/**
* Checks that the test result has exception.
*
- * @return Boolean
+ * @return boolean
*/
public function hasException();
diff --git a/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php b/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
index 555e75fa8..10b74bf75 100644
--- a/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
+++ b/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
@@ -27,7 +27,7 @@ interface ResultInterpretation
*
* @param TestResult $result
*
- * @return Boolean
+ * @return boolean
*/
public function isFailure(TestResult $result);
}
diff --git a/src/Behat/Testwork/Tester/Result/TestResult.php b/src/Behat/Testwork/Tester/Result/TestResult.php
index 9d557965d..b017fff23 100644
--- a/src/Behat/Testwork/Tester/Result/TestResult.php
+++ b/src/Behat/Testwork/Tester/Result/TestResult.php
@@ -25,7 +25,7 @@ interface TestResult
/**
* Checks that test has passed.
*
- * @return Boolean
+ * @return boolean
*/
public function isPassed();
diff --git a/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php b/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
index 55bcfa9da..d81268119 100644
--- a/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
+++ b/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
@@ -123,7 +123,7 @@ public function process(ContainerBuilder $container)
* Loads exercise cli controllers.
*
* @param ContainerBuilder $container
- * @param Boolean $skip
+ * @param boolean $skip
*/
protected function loadExerciseController(ContainerBuilder $container, $skip = false)
{
@@ -142,7 +142,7 @@ protected function loadExerciseController(ContainerBuilder $container, $skip = f
* Loads exercise cli controllers.
*
* @param ContainerBuilder $container
- * @param Boolean $strict
+ * @param boolean $strict
*/
protected function loadStrictController(ContainerBuilder $container, $strict = false)
{
diff --git a/src/Behat/Testwork/Tester/Setup/Setup.php b/src/Behat/Testwork/Tester/Setup/Setup.php
index e904ebb35..4e83d2558 100644
--- a/src/Behat/Testwork/Tester/Setup/Setup.php
+++ b/src/Behat/Testwork/Tester/Setup/Setup.php
@@ -20,14 +20,14 @@ interface Setup
/**
* Returns true if fixtures have been handled successfully.
*
- * @return Boolean
+ * @return boolean
*/
public function isSuccessful();
/**
* Checks if setup has produced any output.
*
- * @return Boolean
+ * @return boolean
*/
public function hasOutput();
}
diff --git a/src/Behat/Testwork/Tester/Setup/Teardown.php b/src/Behat/Testwork/Tester/Setup/Teardown.php
index fbb445b17..0303709c0 100644
--- a/src/Behat/Testwork/Tester/Setup/Teardown.php
+++ b/src/Behat/Testwork/Tester/Setup/Teardown.php
@@ -20,14 +20,14 @@ interface Teardown
/**
* Returns true if fixtures have been handled successfully.
*
- * @return Boolean
+ * @return boolean
*/
public function isSuccessful();
/**
* Checks if tear down has produced any output.
*
- * @return Boolean
+ * @return boolean
*/
public function hasOutput();
}
diff --git a/src/Behat/Testwork/Tester/SpecificationTester.php b/src/Behat/Testwork/Tester/SpecificationTester.php
index 9dc106a22..00ac817b0 100644
--- a/src/Behat/Testwork/Tester/SpecificationTester.php
+++ b/src/Behat/Testwork/Tester/SpecificationTester.php
@@ -27,7 +27,7 @@ interface SpecificationTester
*
* @param Environment $env
* @param mixed $spec
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -38,7 +38,7 @@ public function setUp(Environment $env, $spec, $skip);
*
* @param Environment $env
* @param mixed $spec
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -49,7 +49,7 @@ public function test(Environment $env, $spec, $skip);
*
* @param Environment $env
* @param mixed $spec
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Tester/SuiteTester.php b/src/Behat/Testwork/Tester/SuiteTester.php
index f139f1a14..532665ae2 100644
--- a/src/Behat/Testwork/Tester/SuiteTester.php
+++ b/src/Behat/Testwork/Tester/SuiteTester.php
@@ -28,7 +28,7 @@ interface SuiteTester
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return Setup
*/
@@ -39,7 +39,7 @@ public function setUp(Environment $env, SpecificationIterator $iterator, $skip);
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param Boolean $skip
+ * @param boolean $skip
*
* @return TestResult
*/
@@ -50,7 +50,7 @@ public function test(Environment $env, SpecificationIterator $iterator, $skip);
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param Boolean $skip
+ * @param boolean $skip
* @param TestResult $result
*
* @return Teardown
From 5cec16d9fd3a53ace9220e272e4518bb208296fc Mon Sep 17 00:00:00 2001
From: Witold Wasiczko
Date: Wed, 26 Jun 2019 23:35:28 +0200
Subject: [PATCH 164/567] boolean -> bool
---
.../Context/Cli/InteractiveContextIdentifier.php | 2 +-
.../Context/ContextClass/ClassGenerator.php | 2 +-
.../Behat/Context/ContextClass/ClassResolver.php | 2 +-
.../Context/Environment/ContextEnvironment.php | 4 ++--
.../Context/Reader/AnnotatedContextReader.php | 6 +++---
.../Snippet/Appender/ContextSnippetAppender.php | 2 +-
.../Definition/Pattern/Policy/PatternPolicy.php | 4 ++--
src/Behat/Behat/Definition/SearchResult.php | 2 +-
.../EventDispatcher/Event/AfterStepSetup.php | 2 +-
.../EventDispatcher/Event/AfterStepTested.php | 8 ++++----
.../EventDispatcher/Event/BeforeStepTeardown.php | 6 +++---
.../Gherkin/Suite/Setup/SuiteWithPathsSetup.php | 2 +-
src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php | 6 +++---
.../Behat/Hook/Call/RuntimeScenarioHook.php | 6 +++---
src/Behat/Behat/Hook/Call/RuntimeStepHook.php | 2 +-
.../EventListener/AST/OutlineTableListener.php | 2 +-
.../Flow/FireOnlySiblingsListener.php | 2 +-
.../Flow/FirstBackgroundFiresFirstListener.php | 4 ++--
.../Flow/OnlyFirstBackgroundFiresListener.php | 16 ++++++++--------
.../Node/Printer/Pretty/PrettySetupPrinter.php | 4 ++--
.../Printer/Pretty/PrettySkippedStepPrinter.php | 2 +-
.../Node/Printer/Pretty/PrettyStepPrinter.php | 2 +-
.../Behat/Snippet/Appender/SnippetAppender.php | 2 +-
.../Behat/Snippet/Generator/SnippetGenerator.php | 2 +-
src/Behat/Behat/Snippet/SnippetRegistry.php | 2 +-
src/Behat/Behat/Tester/BackgroundTester.php | 6 +++---
src/Behat/Behat/Tester/OutlineTester.php | 6 +++---
.../Tester/Runtime/RuntimeScenarioTester.php | 2 +-
.../Behat/Tester/Runtime/RuntimeStepTester.php | 2 +-
src/Behat/Behat/Tester/ScenarioTester.php | 6 +++---
src/Behat/Behat/Tester/StepContainerTester.php | 2 +-
src/Behat/Behat/Tester/StepTester.php | 6 +++---
.../SimpleArgumentTransformation.php | 2 +-
.../Transformer/ArgumentTransformer.php | 2 +-
.../Testwork/Argument/MixedArgumentOrganiser.php | 14 +++++++-------
.../Argument/PregMatchArgumentOrganiser.php | 2 +-
src/Behat/Testwork/Call/CallResult.php | 4 ++--
src/Behat/Testwork/Call/CallResults.php | 4 ++--
src/Behat/Testwork/Call/Callee.php | 4 ++--
src/Behat/Testwork/Call/Filter/CallFilter.php | 2 +-
src/Behat/Testwork/Call/Filter/ResultFilter.php | 2 +-
src/Behat/Testwork/Call/Handler/CallHandler.php | 2 +-
.../Testwork/Call/Handler/RuntimeCallHandler.php | 4 ++--
src/Behat/Testwork/Call/RuntimeCallee.php | 4 ++--
.../Environment/Handler/EnvironmentHandler.php | 4 ++--
.../Environment/Reader/EnvironmentReader.php | 2 +-
.../Exception/Stringer/ExceptionStringer.php | 2 +-
.../Testwork/Hook/Call/RuntimeSuiteHook.php | 2 +-
src/Behat/Testwork/Hook/FilterableHook.php | 2 +-
src/Behat/Testwork/Ordering/OrderedExercise.php | 6 +++---
.../Testwork/Output/Cli/OutputController.php | 6 +++---
src/Behat/Testwork/Output/OutputManager.php | 2 +-
.../Output/Printer/Factory/OutputFactory.php | 2 +-
.../Testwork/Output/Printer/OutputPrinter.php | 2 +-
.../Configuration/ConfigurationLoader.php | 2 +-
.../Testwork/Suite/Generator/SuiteGenerator.php | 2 +-
src/Behat/Testwork/Suite/GenericSuite.php | 2 +-
src/Behat/Testwork/Suite/Setup/SuiteSetup.php | 2 +-
src/Behat/Testwork/Suite/Suite.php | 2 +-
src/Behat/Testwork/Suite/SuiteRegistry.php | 2 +-
.../Testwork/Tester/Cli/ExerciseController.php | 4 ++--
.../Testwork/Tester/Cli/StrictController.php | 4 ++--
src/Behat/Testwork/Tester/Exercise.php | 6 +++---
.../Testwork/Tester/Result/ExceptionResult.php | 2 +-
.../Interpretation/ResultInterpretation.php | 2 +-
src/Behat/Testwork/Tester/Result/TestResult.php | 2 +-
.../Tester/ServiceContainer/TesterExtension.php | 4 ++--
src/Behat/Testwork/Tester/Setup/Setup.php | 4 ++--
src/Behat/Testwork/Tester/Setup/Teardown.php | 4 ++--
.../Testwork/Tester/SpecificationTester.php | 6 +++---
src/Behat/Testwork/Tester/SuiteTester.php | 6 +++---
71 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 286ffde12..5f3791743 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -98,7 +98,7 @@ private function askQuestion($message, $choices, $default)
/**
* Checks if interactive mode is supported.
*
- * @return boolean
+ * @return bool
*
* @deprecated there is a better way to do it - `InputInterface::isInteractive()` method.
* Sadly, this doesn't work properly prior Symfony\Console 2.7 and as we need
diff --git a/src/Behat/Behat/Context/ContextClass/ClassGenerator.php b/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
index 61b3fc1d8..0a7cb5e19 100644
--- a/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
+++ b/src/Behat/Behat/Context/ContextClass/ClassGenerator.php
@@ -28,7 +28,7 @@ interface ClassGenerator
* @param Suite $suite
* @param string $contextClass
*
- * @return boolean
+ * @return bool
*/
public function supportsSuiteAndClass(Suite $suite, $contextClass);
diff --git a/src/Behat/Behat/Context/ContextClass/ClassResolver.php b/src/Behat/Behat/Context/ContextClass/ClassResolver.php
index a97680ee6..dce0f8049 100644
--- a/src/Behat/Behat/Context/ContextClass/ClassResolver.php
+++ b/src/Behat/Behat/Context/ContextClass/ClassResolver.php
@@ -26,7 +26,7 @@ interface ClassResolver
*
* @param string $contextString
*
- * @return boolean
+ * @return bool
*/
public function supportsClass($contextString);
diff --git a/src/Behat/Behat/Context/Environment/ContextEnvironment.php b/src/Behat/Behat/Context/Environment/ContextEnvironment.php
index 90acc4db3..44bcf29b8 100644
--- a/src/Behat/Behat/Context/Environment/ContextEnvironment.php
+++ b/src/Behat/Behat/Context/Environment/ContextEnvironment.php
@@ -25,7 +25,7 @@ interface ContextEnvironment extends Environment
/**
* Checks if environment has any contexts registered.
*
- * @return boolean
+ * @return bool
*/
public function hasContexts();
@@ -41,7 +41,7 @@ public function getContextClasses();
*
* @param string $class
*
- * @return boolean
+ * @return bool
*/
public function hasContextClass($class);
}
diff --git a/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
index 722473f1c..02baea625 100644
--- a/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
+++ b/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php
@@ -180,7 +180,7 @@ private function readDescription($docBlock)
*
* @param string $docLine
*
- * @return boolean
+ * @return bool
*/
private function isEmpty($docLine)
{
@@ -192,7 +192,7 @@ private function isEmpty($docLine)
*
* @param string $docLine
*
- * @return boolean
+ * @return bool
*/
private function isNotAnnotation($docLine)
{
@@ -229,7 +229,7 @@ private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $
*
* @param string $docLine
*
- * @return boolean
+ * @return bool
*/
private function isIgnoredAnnotation($docLine)
{
diff --git a/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php b/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
index 7af719c36..82e6ec35a 100644
--- a/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
+++ b/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php
@@ -81,7 +81,7 @@ public function appendSnippet(AggregateSnippet $snippet)
* @param string $class
* @param string $contextFileContent
*
- * @return boolean
+ * @return bool
*/
private function isClassImported($class, $contextFileContent)
{
diff --git a/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php b/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
index cbad76e50..cd3daac5c 100644
--- a/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
+++ b/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php
@@ -27,7 +27,7 @@ interface PatternPolicy
*
* @param string $type
*
- * @return boolean
+ * @return bool
*/
public function supportsPatternType($type);
@@ -45,7 +45,7 @@ public function generatePattern($stepText);
*
* @param string $pattern
*
- * @return boolean
+ * @return bool
*/
public function supportsPattern($pattern);
diff --git a/src/Behat/Behat/Definition/SearchResult.php b/src/Behat/Behat/Definition/SearchResult.php
index 512d6c24c..cdb4191ad 100644
--- a/src/Behat/Behat/Definition/SearchResult.php
+++ b/src/Behat/Behat/Definition/SearchResult.php
@@ -47,7 +47,7 @@ public function __construct(Definition $definition = null, $matchedText = null,
/**
* Checks if result contains a match.
*
- * @return boolean
+ * @return bool
*/
public function hasMatch()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php b/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
index 9eb520fa1..a2256f0c1 100644
--- a/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
+++ b/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php
@@ -86,7 +86,7 @@ public function getSetup()
/**
* Checks if step call, setup or teardown produced any output (stdOut or exception).
*
- * @return boolean
+ * @return bool
*/
public function hasOutput()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php b/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
index 7ddcd9bdc..d5829b77a 100644
--- a/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
+++ b/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php
@@ -111,7 +111,7 @@ public function getTeardown()
/**
* Checks if step call, setup or teardown produced any output (stdOut or exception).
*
- * @return boolean
+ * @return bool
*/
public function hasOutput()
{
@@ -121,7 +121,7 @@ public function hasOutput()
/**
* Checks if step teardown has output.
*
- * @return boolean
+ * @return bool
*/
private function teardownHasOutput()
{
@@ -131,7 +131,7 @@ private function teardownHasOutput()
/**
* Checks if result has produced exception.
*
- * @return boolean
+ * @return bool
*/
private function resultHasException()
{
@@ -141,7 +141,7 @@ private function resultHasException()
/**
* Checks if result is executed and call result has produced exception or stdOut.
*
- * @return boolean
+ * @return bool
*/
private function resultCallHasOutput()
{
diff --git a/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php b/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
index 4bb296ec2..89f626fc5 100644
--- a/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
+++ b/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php
@@ -93,7 +93,7 @@ public function getTestResult()
/**
* Checks if step call produced any output (stdOut or exception).
*
- * @return boolean
+ * @return bool
*/
public function hasOutput()
{
@@ -103,7 +103,7 @@ public function hasOutput()
/**
* Checks if result has produced exception.
*
- * @return boolean
+ * @return bool
*/
private function resultHasException()
{
@@ -113,7 +113,7 @@ private function resultHasException()
/**
* Checks if result is executed and call result has produced exception or stdOut.
*
- * @return boolean
+ * @return bool
*/
private function resultCallHasOutput()
{
diff --git a/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
index 5147d4f11..f50249f6e 100644
--- a/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
+++ b/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php
@@ -97,7 +97,7 @@ private function locatePath($path)
*
* @param string $file A file path
*
- * @return boolean
+ * @return bool
*/
private function isAbsolutePath($file)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
index 8b3ca5348..9bc9a554f 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php
@@ -68,7 +68,7 @@ public function filterMatches(HookScope $scope)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
private function isMatch(FeatureNode $feature, $filterString)
{
@@ -89,7 +89,7 @@ private function isMatch(FeatureNode $feature, $filterString)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
private function isMatchTagFilter(FeatureNode $feature, $filterString)
{
@@ -104,7 +104,7 @@ private function isMatchTagFilter(FeatureNode $feature, $filterString)
* @param FeatureNode $feature
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
private function isMatchNameFilter(FeatureNode $feature, $filterString)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
index 9bb6bbb8c..d8a401d48 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php
@@ -48,7 +48,7 @@ public function filterMatches(HookScope $scope)
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
{
@@ -70,7 +70,7 @@ protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $f
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString)
{
@@ -89,7 +89,7 @@ protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $sce
* @param ScenarioInterface $scenario
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString)
{
diff --git a/src/Behat/Behat/Hook/Call/RuntimeStepHook.php b/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
index 57ea7641b..401e3ccdf 100644
--- a/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
+++ b/src/Behat/Behat/Hook/Call/RuntimeStepHook.php
@@ -55,7 +55,7 @@ public function filterMatches(HookScope $scope)
* @param StepNode $step
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
private function isStepMatch(StepNode $step, $filterString)
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
index 490dfbbb5..9882b7c64 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
@@ -61,7 +61,7 @@ final class OutlineTableListener implements EventListener
*/
private $exampleSetup;
/**
- * @var boolean
+ * @var bool
*/
private $headerPrinted = false;
/**
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
index 44db35bb8..0a4c85674 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
@@ -37,7 +37,7 @@ class FireOnlySiblingsListener implements EventListener
*/
private $descendant;
/**
- * @var boolean
+ * @var bool
*/
private $inContext = false;
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
index b63824d6a..271b8e580 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
@@ -34,7 +34,7 @@ class FirstBackgroundFiresFirstListener implements EventListener
*/
private $descendant;
/**
- * @var boolean
+ * @var bool
*/
private $firstBackgroundEnded = false;
/**
@@ -103,7 +103,7 @@ private function markFirstBackgroundPrintedAfterBackground($eventName)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event)
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
index 4a0278c06..2af5ba2d9 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
@@ -36,15 +36,15 @@ class OnlyFirstBackgroundFiresListener implements EventListener
*/
private $descendant;
/**
- * @var boolean
+ * @var bool
*/
private $firstBackgroundEnded = false;
/**
- * @var boolean
+ * @var bool
*/
private $inBackground = false;
/**
- * @var boolean
+ * @var bool
*/
private $stepSetupHadOutput = false;
@@ -125,7 +125,7 @@ private function markFirstBackgroundPrintedAfterBackground($eventName)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isSkippableEvent(Event $event)
{
@@ -141,7 +141,7 @@ private function isSkippableEvent(Event $event)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isNonFailingConsequentBackgroundStep(Event $event)
{
@@ -157,7 +157,7 @@ private function isNonFailingConsequentBackgroundStep(Event $event)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isStepEventWithOutput(Event $event)
{
@@ -169,7 +169,7 @@ private function isStepEventWithOutput(Event $event)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isBeforeStepEventWithOutput(Event $event)
{
@@ -187,7 +187,7 @@ private function isBeforeStepEventWithOutput(Event $event)
*
* @param Event $event
*
- * @return boolean
+ * @return bool
*/
private function isAfterStepWithOutput(Event $event)
{
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
index 09e900788..5475f51fe 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php
@@ -56,8 +56,8 @@ final class PrettySetupPrinter implements SetupPrinter
* @param ResultToStringConverter $resultConverter
* @param ExceptionPresenter $exceptionPresenter
* @param integer $indentation
- * @param boolean $newlineBefore
- * @param boolean $newlineAfter
+ * @param bool $newlineBefore
+ * @param bool $newlineAfter
*/
public function __construct(
ResultToStringConverter $resultConverter,
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
index 2ec682556..b8c8d464a 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php
@@ -129,7 +129,7 @@ private function printArguments(Formatter $formatter, array $arguments)
* Returns argument string for provided argument.
*
* @param ArgumentInterface $argument
- * @param boolean $collapse
+ * @param bool $collapse
*
* @return string
*/
diff --git a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
index 9604c1021..ee2e5d09e 100644
--- a/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php
@@ -180,7 +180,7 @@ private function printException(OutputPrinter $printer, StepResult $result)
* Returns argument string for provided argument.
*
* @param ArgumentInterface $argument
- * @param boolean $collapse
+ * @param bool $collapse
*
* @return string
*/
diff --git a/src/Behat/Behat/Snippet/Appender/SnippetAppender.php b/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
index e78d6bea4..863d88fb3 100644
--- a/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
+++ b/src/Behat/Behat/Snippet/Appender/SnippetAppender.php
@@ -27,7 +27,7 @@ interface SnippetAppender
*
* @param AggregateSnippet $snippet
*
- * @return boolean
+ * @return bool
*/
public function supportsSnippet(AggregateSnippet $snippet);
diff --git a/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php b/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
index 5e68af1fe..09bbd1164 100644
--- a/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
+++ b/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php
@@ -30,7 +30,7 @@ interface SnippetGenerator
* @param Environment $environment
* @param StepNode $step
*
- * @return boolean
+ * @return bool
*/
public function supportsEnvironmentAndStep(Environment $environment, StepNode $step);
diff --git a/src/Behat/Behat/Snippet/SnippetRegistry.php b/src/Behat/Behat/Snippet/SnippetRegistry.php
index 6bdbbebf7..7b9257263 100644
--- a/src/Behat/Behat/Snippet/SnippetRegistry.php
+++ b/src/Behat/Behat/Snippet/SnippetRegistry.php
@@ -34,7 +34,7 @@ final class SnippetRegistry implements SnippetRepository
*/
private $snippets = array();
/**
- * @var boolean
+ * @var bool
*/
private $snippetsGenerated = false;
diff --git a/src/Behat/Behat/Tester/BackgroundTester.php b/src/Behat/Behat/Tester/BackgroundTester.php
index 4a8c823ec..10086c76c 100644
--- a/src/Behat/Behat/Tester/BackgroundTester.php
+++ b/src/Behat/Behat/Tester/BackgroundTester.php
@@ -28,7 +28,7 @@ interface BackgroundTester
*
* @param Environment $env
* @param FeatureNode $feature
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -39,7 +39,7 @@ public function setUp(Environment $env, FeatureNode $feature, $skip);
*
* @param Environment $env
* @param FeatureNode $feature
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -50,7 +50,7 @@ public function test(Environment $env, FeatureNode $feature, $skip);
*
* @param Environment $env
* @param FeatureNode $feature
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/OutlineTester.php b/src/Behat/Behat/Tester/OutlineTester.php
index 144f1caf4..43b45e62f 100644
--- a/src/Behat/Behat/Tester/OutlineTester.php
+++ b/src/Behat/Behat/Tester/OutlineTester.php
@@ -30,7 +30,7 @@ interface OutlineTester
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outli
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, OutlineNode $outlin
* @param Environment $env
* @param FeatureNode $feature
* @param OutlineNode $outline
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php b/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
index 47ec35f1b..08b8ca951 100644
--- a/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
+++ b/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php
@@ -91,7 +91,7 @@ public function tearDown(Environment $env, FeatureNode $feature, Scenario $scena
*
* @param Environment $env
* @param FeatureNode $feature
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
diff --git a/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php b/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
index 82e76c144..46959f6de 100644
--- a/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
+++ b/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php
@@ -107,7 +107,7 @@ private function searchDefinition(Environment $env, FeatureNode $feature, StepNo
* @param FeatureNode $feature
* @param StepNode $step
* @param SearchResult $search
- * @param boolean $skip
+ * @param bool $skip
*
* @return StepResult
*/
diff --git a/src/Behat/Behat/Tester/ScenarioTester.php b/src/Behat/Behat/Tester/ScenarioTester.php
index ae3baef5e..601e4f67a 100644
--- a/src/Behat/Behat/Tester/ScenarioTester.php
+++ b/src/Behat/Behat/Tester/ScenarioTester.php
@@ -30,7 +30,7 @@ interface ScenarioTester
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, Scenario $scenario,
* @param Environment $env
* @param FeatureNode $feature
* @param Scenario $scenario
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Tester/StepContainerTester.php b/src/Behat/Behat/Tester/StepContainerTester.php
index a78ac1003..d7364a9bc 100644
--- a/src/Behat/Behat/Tester/StepContainerTester.php
+++ b/src/Behat/Behat/Tester/StepContainerTester.php
@@ -45,7 +45,7 @@ public function __construct(StepTester $stepTester)
* @param Environment $env
* @param FeatureNode $feature
* @param StepContainerInterface $container
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult[]
*/
diff --git a/src/Behat/Behat/Tester/StepTester.php b/src/Behat/Behat/Tester/StepTester.php
index 7ffd7b35b..94d735778 100644
--- a/src/Behat/Behat/Tester/StepTester.php
+++ b/src/Behat/Behat/Tester/StepTester.php
@@ -30,7 +30,7 @@ interface StepTester
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -42,7 +42,7 @@ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $s
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param boolean $skip
+ * @param bool $skip
*
* @return StepResult
*/
@@ -54,7 +54,7 @@ public function test(Environment $env, FeatureNode $feature, StepNode $step, $sk
* @param Environment $env
* @param FeatureNode $feature
* @param StepNode $step
- * @param boolean $skip
+ * @param bool $skip
* @param StepResult $result
*
* @return Teardown
diff --git a/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php b/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
index c8a71a6e4..16530c3f7 100644
--- a/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
+++ b/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php
@@ -45,7 +45,7 @@ public function getPriority();
* @param integer|string $argumentIndex
* @param mixed $argumentValue
*
- * @return boolean
+ * @return bool
*/
public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue);
diff --git a/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php b/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
index f49be2dcd..4457d838b 100644
--- a/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
+++ b/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php
@@ -26,7 +26,7 @@ interface ArgumentTransformer
* @param integer|string $argumentIndex
* @param mixed $argumentValue
*
- * @return boolean
+ * @return bool
*/
public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue);
diff --git a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
index d21e8bd5d..6acea5fdd 100644
--- a/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php
@@ -99,7 +99,7 @@ function (ReflectionParameter $parameter) {
* @param mixed $argumentKey
* @param string[] $parameterNames
*
- * @return boolean
+ * @return bool
*/
private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
{
@@ -112,7 +112,7 @@ private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames)
* @param ReflectionParameter[] $parameters
* @param mixed $value
*
- * @return boolean
+ * @return bool
*/
private function isParameterTypehintedInArgumentList(array $parameters, $value)
{
@@ -135,7 +135,7 @@ private function isParameterTypehintedInArgumentList(array $parameters, $value)
* @param object $value
* @param ReflectionParameter $parameter
*
- * @return boolean
+ * @return bool
*/
private function isValueMatchesTypehintedParameter($value, ReflectionParameter $parameter)
{
@@ -274,7 +274,7 @@ private function applyPredicateToTypehintedArguments(
* @param mixed[] &$candidates Resolved arguments
* @param mixed[] &$arguments Argument mapping
* @param callable $predicate Callable predicate to apply to each candidate
- * @return boolean Returns true if a candidate has been matched to the given parameter, otherwise false
+ * @return bool Returns true if a candidate has been matched to the given parameter, otherwise false
*/
public function matchParameterToCandidateUsingPredicate(
ReflectionParameter $parameter,
@@ -304,7 +304,7 @@ public function matchParameterToCandidateUsingPredicate(
*
* @param ReflectionClass $reflectionClass Typehinted argument
* @param mixed $candidate Resolved argument
- * @return boolean
+ * @return bool
*/
private function classMatchingPredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate)
{
@@ -316,7 +316,7 @@ private function classMatchingPredicateForTypehintedArguments(ReflectionClass $r
*
* @param ReflectionClass $reflectionClass Typehinted argument
* @param mixed $candidate Resolved argument
- * @return boolean
+ * @return bool
*/
private function isInstancePredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate)
{
@@ -425,7 +425,7 @@ private function markArgumentDefined($position)
*
* @param integer $position
*
- * @return boolean
+ * @return bool
*/
private function isArgumentDefined($position)
{
diff --git a/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php b/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
index a49d3920a..8a03b884f 100644
--- a/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
+++ b/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php
@@ -81,7 +81,7 @@ private function cleanupMatchDuplicates(array $match)
* @param integer $keyIndex
* @param mixed[] $keys
*
- * @return boolean
+ * @return bool
*/
private function isKeyAStringAndNexOneIsAnInteger($keyIndex, array $keys)
{
diff --git a/src/Behat/Testwork/Call/CallResult.php b/src/Behat/Testwork/Call/CallResult.php
index 6bb4c69ec..924ce0d8a 100644
--- a/src/Behat/Testwork/Call/CallResult.php
+++ b/src/Behat/Testwork/Call/CallResult.php
@@ -75,7 +75,7 @@ public function getReturn()
/**
* Check if call thrown exception.
*
- * @return boolean
+ * @return bool
*/
public function hasException()
{
@@ -95,7 +95,7 @@ public function getException()
/**
* Checks if call produced stdOut.
*
- * @return boolean
+ * @return bool
*/
public function hasStdOut()
{
diff --git a/src/Behat/Testwork/Call/CallResults.php b/src/Behat/Testwork/Call/CallResults.php
index bd0048872..d1aeeda57 100644
--- a/src/Behat/Testwork/Call/CallResults.php
+++ b/src/Behat/Testwork/Call/CallResults.php
@@ -53,7 +53,7 @@ public static function merge(CallResults $first, CallResults $second)
/**
* Checks if any call in collection throws an exception.
*
- * @return boolean
+ * @return bool
*/
public function hasExceptions()
{
@@ -69,7 +69,7 @@ public function hasExceptions()
/**
* Checks if any call in collection produces an output.
*
- * @return boolean
+ * @return bool
*/
public function hasStdOuts()
{
diff --git a/src/Behat/Testwork/Call/Callee.php b/src/Behat/Testwork/Call/Callee.php
index 240d8d5c1..17ed0f5cc 100644
--- a/src/Behat/Testwork/Call/Callee.php
+++ b/src/Behat/Testwork/Call/Callee.php
@@ -36,14 +36,14 @@ public function getDescription();
/**
* Returns true if callee is a method, false otherwise.
*
- * @return boolean
+ * @return bool
*/
public function isAMethod();
/**
* Returns true if callee is an instance (non-static) method, false otherwise.
*
- * @return boolean
+ * @return bool
*/
public function isAnInstanceMethod();
diff --git a/src/Behat/Testwork/Call/Filter/CallFilter.php b/src/Behat/Testwork/Call/Filter/CallFilter.php
index 7565d8af2..1519823db 100644
--- a/src/Behat/Testwork/Call/Filter/CallFilter.php
+++ b/src/Behat/Testwork/Call/Filter/CallFilter.php
@@ -27,7 +27,7 @@ interface CallFilter
*
* @param Call $call
*
- * @return boolean
+ * @return bool
*/
public function supportsCall(Call $call);
diff --git a/src/Behat/Testwork/Call/Filter/ResultFilter.php b/src/Behat/Testwork/Call/Filter/ResultFilter.php
index 66dabef18..02267029a 100644
--- a/src/Behat/Testwork/Call/Filter/ResultFilter.php
+++ b/src/Behat/Testwork/Call/Filter/ResultFilter.php
@@ -27,7 +27,7 @@ interface ResultFilter
*
* @param CallResult $result
*
- * @return boolean
+ * @return bool
*/
public function supportsResult(CallResult $result);
diff --git a/src/Behat/Testwork/Call/Handler/CallHandler.php b/src/Behat/Testwork/Call/Handler/CallHandler.php
index 78c6df57b..93966130d 100644
--- a/src/Behat/Testwork/Call/Handler/CallHandler.php
+++ b/src/Behat/Testwork/Call/Handler/CallHandler.php
@@ -28,7 +28,7 @@ interface CallHandler
*
* @param Call $call
*
- * @return boolean
+ * @return bool
*/
public function supportsCall(Call $call);
diff --git a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
index 8f09a406f..7db716556 100644
--- a/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
+++ b/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php
@@ -77,7 +77,7 @@ public function handleCall(Call $call)
* @param string $file
* @param integer $line
*
- * @return boolean
+ * @return bool
*
* @throws CallErrorException
*/
@@ -154,7 +154,7 @@ private function stopErrorAndOutputBuffering()
*
* @param integer $level
*
- * @return boolean
+ * @return bool
*/
private function errorLevelIsNotReportable($level)
{
diff --git a/src/Behat/Testwork/Call/RuntimeCallee.php b/src/Behat/Testwork/Call/RuntimeCallee.php
index 710697a82..fa232f836 100644
--- a/src/Behat/Testwork/Call/RuntimeCallee.php
+++ b/src/Behat/Testwork/Call/RuntimeCallee.php
@@ -112,7 +112,7 @@ public function getReflection()
/**
* Returns true if callee is a method, false otherwise.
*
- * @return boolean
+ * @return bool
*/
public function isAMethod()
{
@@ -122,7 +122,7 @@ public function isAMethod()
/**
* Returns true if callee is an instance (non-static) method, false otherwise.
*
- * @return boolean
+ * @return bool
*/
public function isAnInstanceMethod()
{
diff --git a/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php b/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
index 062de8f78..1b4358919 100644
--- a/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
+++ b/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php
@@ -28,7 +28,7 @@ interface EnvironmentHandler
*
* @param Suite $suite
*
- * @return boolean
+ * @return bool
*/
public function supportsSuite(Suite $suite);
@@ -47,7 +47,7 @@ public function buildEnvironment(Suite $suite);
* @param Environment $environment
* @param mixed $testSubject
*
- * @return boolean
+ * @return bool
*/
public function supportsEnvironmentAndSubject(Environment $environment, $testSubject = null);
diff --git a/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php b/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
index 9c7430d10..39cd46724 100644
--- a/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
+++ b/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php
@@ -28,7 +28,7 @@ interface EnvironmentReader
*
* @param Environment $environment
*
- * @return boolean
+ * @return bool
*/
public function supportsEnvironment(Environment $environment);
diff --git a/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php b/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
index 0a302b006..5f8de153c 100644
--- a/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
+++ b/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php
@@ -27,7 +27,7 @@ interface ExceptionStringer
*
* @param Exception $exception
*
- * @return boolean
+ * @return bool
*/
public function supportsException(Exception $exception);
diff --git a/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php b/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
index ce9269179..44b7f6573 100644
--- a/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
+++ b/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php
@@ -70,7 +70,7 @@ public function filterMatches(HookScope $scope)
* @param Suite $suite
* @param string $filterString
*
- * @return boolean
+ * @return bool
*/
private function isSuiteMatch(Suite $suite, $filterString)
{
diff --git a/src/Behat/Testwork/Hook/FilterableHook.php b/src/Behat/Testwork/Hook/FilterableHook.php
index 42399f32a..a241ff816 100644
--- a/src/Behat/Testwork/Hook/FilterableHook.php
+++ b/src/Behat/Testwork/Hook/FilterableHook.php
@@ -24,7 +24,7 @@ interface FilterableHook extends Hook
*
* @param HookScope $scope
*
- * @return boolean
+ * @return bool
*/
public function filterMatches(HookScope $scope);
}
diff --git a/src/Behat/Testwork/Ordering/OrderedExercise.php b/src/Behat/Testwork/Ordering/OrderedExercise.php
index 8c4add8cc..aba9ba894 100644
--- a/src/Behat/Testwork/Ordering/OrderedExercise.php
+++ b/src/Behat/Testwork/Ordering/OrderedExercise.php
@@ -58,7 +58,7 @@ public function __construct(Exercise $decoratedExercise)
* Sets up exercise for a test.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -71,7 +71,7 @@ public function setUp(array $iterators, $skip)
* Tests suites specifications.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -84,7 +84,7 @@ public function test(array $iterators, $skip)
* Tears down exercise after a test.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Output/Cli/OutputController.php b/src/Behat/Testwork/Output/Cli/OutputController.php
index 2891f2c7e..bf8f94488 100644
--- a/src/Behat/Testwork/Output/Cli/OutputController.php
+++ b/src/Behat/Testwork/Output/Cli/OutputController.php
@@ -153,7 +153,7 @@ protected function locateOutputPath($path)
*
* @param array $formats
* @param array $outputs
- * @param boolean $decorated
+ * @param bool $decorated
*/
private function configureOutputs(array $formats, array $outputs, $decorated = false)
{
@@ -184,7 +184,7 @@ private function configureOutputs(array $formats, array $outputs, $decorated = f
*
* @param string $outputId
*
- * @return boolean
+ * @return bool
*/
private function isStandardOutput($outputId)
{
@@ -196,7 +196,7 @@ private function isStandardOutput($outputId)
*
* @param string $file A file path
*
- * @return boolean
+ * @return bool
*/
private function isAbsolutePath($file)
{
diff --git a/src/Behat/Testwork/Output/OutputManager.php b/src/Behat/Testwork/Output/OutputManager.php
index b26dc28ee..ede7b574f 100644
--- a/src/Behat/Testwork/Output/OutputManager.php
+++ b/src/Behat/Testwork/Output/OutputManager.php
@@ -58,7 +58,7 @@ public function registerFormatter(Formatter $formatter)
*
* @param string $name
*
- * @return boolean
+ * @return bool
*/
public function isFormatterRegistered($name)
{
diff --git a/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php b/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
index 04b49de7e..6571555ee 100644
--- a/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
+++ b/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php
@@ -83,7 +83,7 @@ public function getOutputStyles()
/**
* Forces output to be decorated.
*
- * @param boolean $decorated
+ * @param bool $decorated
*/
public function setOutputDecorated($decorated)
{
diff --git a/src/Behat/Testwork/Output/Printer/OutputPrinter.php b/src/Behat/Testwork/Output/Printer/OutputPrinter.php
index c6f91a6bf..56fe45793 100644
--- a/src/Behat/Testwork/Output/Printer/OutputPrinter.php
+++ b/src/Behat/Testwork/Output/Printer/OutputPrinter.php
@@ -69,7 +69,7 @@ public function getOutputStyles();
/**
* Forces output to be decorated.
*
- * @param boolean $decorated
+ * @param bool $decorated
*/
public function setOutputDecorated($decorated);
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
index 5de153e88..dfc02eb4d 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php
@@ -29,7 +29,7 @@ final class ConfigurationLoader
*/
private $environmentVariable;
/**
- * @var boolean
+ * @var bool
*/
private $profileFound;
/**
diff --git a/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php b/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
index a6b1c1b1d..5d8934683 100644
--- a/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
+++ b/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php
@@ -28,7 +28,7 @@ interface SuiteGenerator
* @param string $type
* @param array $settings
*
- * @return boolean
+ * @return bool
*/
public function supportsTypeAndSettings($type, array $settings);
diff --git a/src/Behat/Testwork/Suite/GenericSuite.php b/src/Behat/Testwork/Suite/GenericSuite.php
index 3111bc0ce..1c6702b61 100644
--- a/src/Behat/Testwork/Suite/GenericSuite.php
+++ b/src/Behat/Testwork/Suite/GenericSuite.php
@@ -65,7 +65,7 @@ public function getSettings()
*
* @param string $key
*
- * @return boolean
+ * @return bool
*/
public function hasSetting($key)
{
diff --git a/src/Behat/Testwork/Suite/Setup/SuiteSetup.php b/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
index 2dc25da7f..75eef7c13 100644
--- a/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
+++ b/src/Behat/Testwork/Suite/Setup/SuiteSetup.php
@@ -27,7 +27,7 @@ interface SuiteSetup
*
* @param Suite $suite
*
- * @return boolean
+ * @return bool
*/
public function supportsSuite(Suite $suite);
diff --git a/src/Behat/Testwork/Suite/Suite.php b/src/Behat/Testwork/Suite/Suite.php
index 5f2ad3586..e26c1617e 100644
--- a/src/Behat/Testwork/Suite/Suite.php
+++ b/src/Behat/Testwork/Suite/Suite.php
@@ -36,7 +36,7 @@ public function getSettings();
*
* @param string $key
*
- * @return boolean
+ * @return bool
*/
public function hasSetting($key);
diff --git a/src/Behat/Testwork/Suite/SuiteRegistry.php b/src/Behat/Testwork/Suite/SuiteRegistry.php
index ef708fc45..b5f90df46 100644
--- a/src/Behat/Testwork/Suite/SuiteRegistry.php
+++ b/src/Behat/Testwork/Suite/SuiteRegistry.php
@@ -23,7 +23,7 @@
final class SuiteRegistry implements SuiteRepository
{
/**
- * @var boolean
+ * @var bool
*/
private $suitesGenerated = false;
/**
diff --git a/src/Behat/Testwork/Tester/Cli/ExerciseController.php b/src/Behat/Testwork/Tester/Cli/ExerciseController.php
index e88bbfc6c..2fc5642e1 100644
--- a/src/Behat/Testwork/Tester/Cli/ExerciseController.php
+++ b/src/Behat/Testwork/Tester/Cli/ExerciseController.php
@@ -52,7 +52,7 @@ final class ExerciseController implements Controller
*/
private $resultInterpreter;
/**
- * @var boolean
+ * @var bool
*/
private $skip;
@@ -63,7 +63,7 @@ final class ExerciseController implements Controller
* @param SpecificationFinder $specificationFinder
* @param Exercise $exercise
* @param ResultInterpreter $resultInterpreter
- * @param boolean $skip
+ * @param bool $skip
*/
public function __construct(
SuiteRepository $suiteRepository,
diff --git a/src/Behat/Testwork/Tester/Cli/StrictController.php b/src/Behat/Testwork/Tester/Cli/StrictController.php
index 6ea5fdac5..697b881fc 100644
--- a/src/Behat/Testwork/Tester/Cli/StrictController.php
+++ b/src/Behat/Testwork/Tester/Cli/StrictController.php
@@ -30,7 +30,7 @@ final class StrictController implements Controller
*/
private $resultInterpreter;
/**
- * @var boolean
+ * @var bool
*/
private $strict;
@@ -38,7 +38,7 @@ final class StrictController implements Controller
* Initializes controller.
*
* @param ResultInterpreter $resultInterpreter
- * @param boolean $strict
+ * @param bool $strict
*/
public function __construct(ResultInterpreter $resultInterpreter, $strict = false)
{
diff --git a/src/Behat/Testwork/Tester/Exercise.php b/src/Behat/Testwork/Tester/Exercise.php
index 705cd7d9d..e63883d8c 100644
--- a/src/Behat/Testwork/Tester/Exercise.php
+++ b/src/Behat/Testwork/Tester/Exercise.php
@@ -26,7 +26,7 @@ interface Exercise
* Sets up exercise for a test.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -36,7 +36,7 @@ public function setUp(array $iterators, $skip);
* Tests suites specifications.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -46,7 +46,7 @@ public function test(array $iterators, $skip);
* Tears down exercise after a test.
*
* @param SpecificationIterator[] $iterators
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Tester/Result/ExceptionResult.php b/src/Behat/Testwork/Tester/Result/ExceptionResult.php
index a8d4c68d9..1b724f5c3 100644
--- a/src/Behat/Testwork/Tester/Result/ExceptionResult.php
+++ b/src/Behat/Testwork/Tester/Result/ExceptionResult.php
@@ -22,7 +22,7 @@ interface ExceptionResult extends TestResult
/**
* Checks that the test result has exception.
*
- * @return boolean
+ * @return bool
*/
public function hasException();
diff --git a/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php b/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
index 10b74bf75..cc9250915 100644
--- a/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
+++ b/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php
@@ -27,7 +27,7 @@ interface ResultInterpretation
*
* @param TestResult $result
*
- * @return boolean
+ * @return bool
*/
public function isFailure(TestResult $result);
}
diff --git a/src/Behat/Testwork/Tester/Result/TestResult.php b/src/Behat/Testwork/Tester/Result/TestResult.php
index b017fff23..77281b785 100644
--- a/src/Behat/Testwork/Tester/Result/TestResult.php
+++ b/src/Behat/Testwork/Tester/Result/TestResult.php
@@ -25,7 +25,7 @@ interface TestResult
/**
* Checks that test has passed.
*
- * @return boolean
+ * @return bool
*/
public function isPassed();
diff --git a/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php b/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
index d81268119..85509d5d3 100644
--- a/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
+++ b/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php
@@ -123,7 +123,7 @@ public function process(ContainerBuilder $container)
* Loads exercise cli controllers.
*
* @param ContainerBuilder $container
- * @param boolean $skip
+ * @param bool $skip
*/
protected function loadExerciseController(ContainerBuilder $container, $skip = false)
{
@@ -142,7 +142,7 @@ protected function loadExerciseController(ContainerBuilder $container, $skip = f
* Loads exercise cli controllers.
*
* @param ContainerBuilder $container
- * @param boolean $strict
+ * @param bool $strict
*/
protected function loadStrictController(ContainerBuilder $container, $strict = false)
{
diff --git a/src/Behat/Testwork/Tester/Setup/Setup.php b/src/Behat/Testwork/Tester/Setup/Setup.php
index 4e83d2558..5f6fd45b7 100644
--- a/src/Behat/Testwork/Tester/Setup/Setup.php
+++ b/src/Behat/Testwork/Tester/Setup/Setup.php
@@ -20,14 +20,14 @@ interface Setup
/**
* Returns true if fixtures have been handled successfully.
*
- * @return boolean
+ * @return bool
*/
public function isSuccessful();
/**
* Checks if setup has produced any output.
*
- * @return boolean
+ * @return bool
*/
public function hasOutput();
}
diff --git a/src/Behat/Testwork/Tester/Setup/Teardown.php b/src/Behat/Testwork/Tester/Setup/Teardown.php
index 0303709c0..7ff253168 100644
--- a/src/Behat/Testwork/Tester/Setup/Teardown.php
+++ b/src/Behat/Testwork/Tester/Setup/Teardown.php
@@ -20,14 +20,14 @@ interface Teardown
/**
* Returns true if fixtures have been handled successfully.
*
- * @return boolean
+ * @return bool
*/
public function isSuccessful();
/**
* Checks if tear down has produced any output.
*
- * @return boolean
+ * @return bool
*/
public function hasOutput();
}
diff --git a/src/Behat/Testwork/Tester/SpecificationTester.php b/src/Behat/Testwork/Tester/SpecificationTester.php
index 00ac817b0..b6e06ff41 100644
--- a/src/Behat/Testwork/Tester/SpecificationTester.php
+++ b/src/Behat/Testwork/Tester/SpecificationTester.php
@@ -27,7 +27,7 @@ interface SpecificationTester
*
* @param Environment $env
* @param mixed $spec
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -38,7 +38,7 @@ public function setUp(Environment $env, $spec, $skip);
*
* @param Environment $env
* @param mixed $spec
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -49,7 +49,7 @@ public function test(Environment $env, $spec, $skip);
*
* @param Environment $env
* @param mixed $spec
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
diff --git a/src/Behat/Testwork/Tester/SuiteTester.php b/src/Behat/Testwork/Tester/SuiteTester.php
index 532665ae2..61dffad7f 100644
--- a/src/Behat/Testwork/Tester/SuiteTester.php
+++ b/src/Behat/Testwork/Tester/SuiteTester.php
@@ -28,7 +28,7 @@ interface SuiteTester
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param boolean $skip
+ * @param bool $skip
*
* @return Setup
*/
@@ -39,7 +39,7 @@ public function setUp(Environment $env, SpecificationIterator $iterator, $skip);
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param boolean $skip
+ * @param bool $skip
*
* @return TestResult
*/
@@ -50,7 +50,7 @@ public function test(Environment $env, SpecificationIterator $iterator, $skip);
*
* @param Environment $env
* @param SpecificationIterator $iterator
- * @param boolean $skip
+ * @param bool $skip
* @param TestResult $result
*
* @return Teardown
From 438dfd766883975aca8d325c7f7d3617d6d0cb21 Mon Sep 17 00:00:00 2001
From: Wouter J
Date: Thu, 3 Oct 2019 00:19:32 +0200
Subject: [PATCH 165/567] Show only user-land trace for exceptions and errors
in very verbose mode
---
features/bootstrap/FeatureContext.php | 12 +++-
features/error_reporting.feature | 56 ++++++++++++++++++-
.../Testwork/Exception/ExceptionPresenter.php | 35 +++++++++++-
3 files changed, 99 insertions(+), 4 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 450e9e829..ff05889f1 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -348,6 +348,13 @@ private function getExpectedOutput(PyStringNode $expectedText)
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
+
+ // error stacktrace
+ $text = preg_replace_callback(
+ '/#\d+ [^:]+:/', function ($matches) {
+ return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
+ }, $text
+ );
}
return $text;
@@ -402,11 +409,14 @@ private function getOutput()
{
$output = $this->process->getErrorOutput() . $this->process->getOutput();
- // Normalize the line endings in the output
+ // Normalize the line endings and directory separators in the output
if ("\n" !== PHP_EOL) {
$output = str_replace(PHP_EOL, "\n", $output);
}
+ // Remove location of the project
+ $output = str_replace(realpath(dirname(dirname(__DIR__))).DIRECTORY_SEPARATOR, '', $output);
+
// Replace wrong warning message of HHVM
$output = str_replace('Notice: Undefined index: ', 'Notice: Undefined offset: ', $output);
diff --git a/features/error_reporting.feature b/features/error_reporting.feature
index 1139b48bc..de192df2a 100644
--- a/features/error_reporting.feature
+++ b/features/error_reporting.feature
@@ -56,6 +56,13 @@ Feature: Error Reporting
PHPUnit\Framework\Assert::assertEquals($arg1, $this->result);
}
+ /**
+ * @When an exception is thrown
+ */
+ public function anExceptionIsThrown()
+ {
+ throw new \Exception('Exception is thrown');
+ }
}
"""
And a file named "features/e_notice_in_scenario.feature" with:
@@ -76,11 +83,21 @@ Feature: Error Reporting
When I push "foo" to that array
And I access array index 0
Then I should get "foo"
+ """
+ And a file named "features/exception_in_scenario.feature" with:
+ """
+ Feature: Error in scenario
+ In order to test the error stacktraces
+ As a contributor of behat
+ I need to have a FeatureContext that triggers an error within steps.
+
+ Scenario: Exception thrown
+ When an exception is thrown
"""
Scenario: With default error reporting
- When I run "behat -f progress --no-colors"
+ When I run "behat -f progress --no-colors features/e_notice_in_scenario.feature"
Then it should fail
And the output should contain:
"""
@@ -101,5 +118,40 @@ Feature: Error Reporting
calls:
error_reporting: 32759
"""
- When I run "behat -f progress --no-colors"
+ When I run "behat -f progress --no-colors features/e_notice_in_scenario.feature"
Then it should pass
+
+ @php-version @php7
+ Scenario: With very verbose error reporting
+ When I run "behat -f progress --no-colors -vv features/exception_in_scenario.feature"
+ Then it should fail
+ And the output should contain:
+ """
+ --- Failed steps:
+
+ 001 Scenario: Exception thrown # features/exception_in_scenario.feature:6
+ When an exception is thrown # features/exception_in_scenario.feature:7
+ Exception: Exception is thrown in features/bootstrap/FeatureContext.php:56
+ Stack trace:
+ #0 [internal function]: FeatureContext->anExceptionIsThrown()
+
+ 1 scenario (1 failed)
+ 1 step (1 failed)
+ """
+
+ @php-version @php7
+ Scenario: With debug verbose error reporting
+ When I run "behat -f progress --no-colors -vvv features/exception_in_scenario.feature"
+ Then it should fail
+ And the output should contain:
+ """
+ --- Failed steps:
+
+ 001 Scenario: Exception thrown # features/exception_in_scenario.feature:6
+ When an exception is thrown # features/exception_in_scenario.feature:7
+ Exception: Exception is thrown in features/bootstrap/FeatureContext.php:56
+ Stack trace:
+ #0 [internal function]: FeatureContext->anExceptionIsThrown()
+ #1 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(109): call_user_func_array(Array, Array)
+ #2 src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php(64): Behat\Testwork\Call\Handler\RuntimeCallHandler->executeCall(Object(Behat\Behat\Definition\Call\DefinitionCall))
+ """
diff --git a/src/Behat/Testwork/Exception/ExceptionPresenter.php b/src/Behat/Testwork/Exception/ExceptionPresenter.php
index fce59bbf6..9ad0d14c2 100644
--- a/src/Behat/Testwork/Exception/ExceptionPresenter.php
+++ b/src/Behat/Testwork/Exception/ExceptionPresenter.php
@@ -13,6 +13,7 @@
use Behat\Testwork\Exception\Stringer\ExceptionStringer;
use Behat\Testwork\Output\Printer\OutputPrinter;
use Exception;
+use Symfony\Component\Console\Output\OutputInterface;
/**
* Presents exceptions as strings using registered stringers.
@@ -93,13 +94,45 @@ public function presentException(Exception $exception, $verbosity = null)
}
}
- if (OutputPrinter::VERBOSITY_VERY_VERBOSE <= $verbosity) {
+ if (OutputInterface::VERBOSITY_VERY_VERBOSE <= $verbosity) {
+ if (OutputInterface::VERBOSITY_DEBUG > $verbosity) {
+ $exception = $this->removeBehatCallsFromTrace($exception);
+ }
+
return $this->relativizePaths(trim($exception));
}
return trim($this->relativizePaths($exception->getMessage()) . ' (' . get_class($exception) . ')');
}
+ private function removeBehatCallsFromTrace(Exception $exception)
+ {
+ $traceOutput = '';
+ foreach ($exception->getTrace() as $i => $trace) {
+ if (isset($trace['file']) && false !== strpos(str_replace('\\', '/', $trace['file']), 'Behat/Testwork/Call/Handler/RuntimeCallHandler')) {
+ break;
+ }
+
+ $traceOutput .= sprintf(
+ '#%d %s: %s()'.PHP_EOL,
+ $i,
+ isset($trace['file']) ? $trace['file'].'('.$trace['line'].')' : '[internal function]',
+ isset($trace['class']) ? $trace['class'].$trace['type'].$trace['function'] : $trace['function']
+ );
+ }
+
+ return sprintf(
+ "%s: %s in %s:%d%sStack trace:%s%s",
+ get_class($exception),
+ $exception->getMessage(),
+ $exception->getFile(),
+ $exception->getLine(),
+ PHP_EOL,
+ PHP_EOL,
+ $traceOutput
+ );
+ }
+
/**
* Relativizes absolute paths in the text.
*
From cc26516da9557853243be3ebc40a1e91e5ff8869 Mon Sep 17 00:00:00 2001
From: Pieter Frenssen
Date: Mon, 4 Nov 2019 16:49:30 +0200
Subject: [PATCH 166/567] Throw a dedicated MissingExtensionException instead
of a generic one.
---
.../Exception/MissingExtensionException.php | 22 +++++++++++++++++++
.../Output/Printer/JUnitOutputPrinter.php | 3 ++-
2 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 src/Behat/Testwork/Output/Exception/MissingExtensionException.php
diff --git a/src/Behat/Testwork/Output/Exception/MissingExtensionException.php b/src/Behat/Testwork/Output/Exception/MissingExtensionException.php
new file mode 100644
index 000000000..a54cdbd9f
--- /dev/null
+++ b/src/Behat/Testwork/Output/Exception/MissingExtensionException.php
@@ -0,0 +1,22 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Testwork\Output\Exception;
+
+use RuntimeException;
+
+/**
+ * Represents an exception thrown when a required extension is missing.
+ *
+ * @author Konstantin Kudryashov
+ */
+class MissingExtensionException extends RuntimeException implements PrinterException
+{
+}
diff --git a/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php b/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
index ec491108f..fa2308553 100644
--- a/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
+++ b/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php
@@ -10,6 +10,7 @@
namespace Behat\Testwork\Output\Printer;
+use Behat\Testwork\Output\Exception\MissingExtensionException;
use Behat\Testwork\Output\Printer\Factory\FilesystemOutputFactory;
use Symfony\Component\Console\Output\OutputInterface;
@@ -59,7 +60,7 @@ public function createNewFile($name, array $testsuitesAttributes = array())
{
// This requires the DOM extension to be enabled.
if (!extension_loaded('dom')) {
- throw new \Exception('The PHP DOM extension is required to generate JUnit reports.');
+ throw new MissingExtensionException('The PHP DOM extension is required to generate JUnit reports.');
}
$this->setFileName(strtolower(trim(preg_replace('/[^[:alnum:]_]+/', '_', $name), '_')));
From 0bcd4af5c48bd156291ba4792be23ea02bc73284 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Sat, 9 Nov 2019 15:45:45 +0000
Subject: [PATCH 167/567] Update CHANGELOG.md
---
CHANGELOG.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b758751ab..de9db3a23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Added
+ * [#1244](https://github.com/Behat/Behat/pull/1244): Hide internal steps from stack traces in very verbose mode
## [3.5.0] - 2018-08-10
### Added
From 5df6e0864fcff09b7429ecb26d75f3cfe889ca2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Koles=C3=A1r=20Andr=C3=A1s?=
Date: Sun, 10 Nov 2019 07:01:46 +0100
Subject: [PATCH 168/567] Add hungarian translation
---
i18n.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/i18n.php b/i18n.php
index 44eda3c91..b7e9e570e 100644
--- a/i18n.php
+++ b/i18n.php
@@ -214,4 +214,21 @@
'undefined_count' => '{1,21,31} %1% не определен|]1,Inf] %1% не определено',
'skipped_count' => '{1,21,31} %1% пропущен|]1,Inf] %1% пропущено',
),
+ 'hu' => array(
+ 'snippet_context_choice' => '%1% sorozat meghatározatlan lépéseket tartalmaz. Válaszd ki a környezetet kódrészlet készÃtéséhez:',
+ 'snippet_proposal_title' => '%1% lépései hiányosak. Hozd létre az alábbi kódrészletekkel:',
+ 'snippet_missing_title' => 'Használd a --snippets-for parancssori kapcsolót kódrészletek készÃtéséhez a %1% sorozat lépéseihez:',
+ 'skipped_scenarios_title' => 'Kihagyott forgatókönyvek:',
+ 'failed_scenarios_title' => 'Sikertelen forgatókönyvek:',
+ 'failed_hooks_title' => 'Sikertelen kampók:',
+ 'failed_steps_title' => 'Sikertelen lépések:',
+ 'pending_steps_title' => 'Elintézendő lépések:',
+ 'scenarios_count' => '{0} Nem volt forgatókönyv|{1} 1 forgatókönyv|]1,Inf] %1% forgatókönyv',
+ 'steps_count' => '{0} Nem volt lépés|{1} 1 lépés|]1,Inf] %1% lépés',
+ 'passed_count' => '[1,Inf] %1% sikeres',
+ 'failed_count' => '[1,Inf] %1% sikertelen',
+ 'pending_count' => '[1,Inf] %1% elintézendő',
+ 'undefined_count' => '[1,Inf] %1% meghatározatlan',
+ 'skipped_count' => '[1,Inf] %1% kihagyott',
+ ),
);
From 8c3ef5a5c5fd7e4d1664848d546e0d5382ec5340 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sat, 23 Nov 2019 12:13:05 +0100
Subject: [PATCH 169/567] Update dependencies to allow Symfony 5.x components
---
composer.json | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/composer.json b/composer.json
index 2246d04e1..2abbfd968 100644
--- a/composer.json
+++ b/composer.json
@@ -18,18 +18,18 @@
"ext-mbstring": "*",
"behat/gherkin": "^4.6.0",
"behat/transliterator": "^1.2",
- "symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3",
- "symfony/config": "~2.3||~3.0||~4.0",
- "symfony/dependency-injection": "~2.1||~3.0||~4.0",
- "symfony/event-dispatcher": "~2.1||~3.0||~4.0",
- "symfony/translation": "~2.3||~3.0||~4.0",
- "symfony/yaml": "~2.1||~3.0||~4.0",
+ "symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3||^5.0.0",
+ "symfony/config": "~2.3||~3.0||~4.0||~5.0",
+ "symfony/dependency-injection": "~2.1||~3.0||~4.0||~5.0",
+ "symfony/event-dispatcher": "~2.1||~3.0||~4.0||~5.0",
+ "symfony/translation": "~2.3||~3.0||~4.0||~5.0",
+ "symfony/yaml": "~2.1||~3.0||~4.0||~5.0",
"psr/container": "^1.0",
"container-interop/container-interop": "^1.2"
},
"require-dev": {
- "symfony/process": "~2.5|~3.0|~4.0",
+ "symfony/process": "~2.5|~3.0|~4.0|~5.0",
"phpunit/phpunit": "^4.8.36|^6.3",
"herrera-io/box": "~1.6.1"
},
From 7d4cac6defc641229ecdadce3e4154f24d4973a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sat, 23 Nov 2019 14:28:21 +0100
Subject: [PATCH 170/567] Added CHANGELOG.MD update
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de9db3a23..8bbc0645c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+ * [#1256](https://github.com/Behat/Behat/pull/1256): Update dependencies to support Symfony 5.x
### Added
* [#1244](https://github.com/Behat/Behat/pull/1244): Hide internal steps from stack traces in very verbose mode
From 63d26f73c592352e8c8a170d56b8af8138844e3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sat, 23 Nov 2019 14:30:11 +0100
Subject: [PATCH 171/567] Adapted all the code to the new components in Symfony
---
features/bootstrap/FeatureContext.php | 31 +++++++++++++------
.../Context/Cli/ContextSnippetsController.php | 2 +-
.../Cli/InteractiveContextIdentifier.php | 2 +-
.../Translator/DefinitionTranslator.php | 10 +++---
.../Cli/StopOnFailureController.php | 4 +--
.../EventDispatchingBackgroundTester.php | 8 ++---
.../Tester/EventDispatchingFeatureTester.php | 8 ++---
.../Tester/EventDispatchingOutlineTester.php | 8 ++---
.../Tester/EventDispatchingScenarioTester.php | 8 ++---
.../Tester/EventDispatchingStepTester.php | 8 ++---
.../Behat/Gherkin/Cli/SyntaxController.php | 2 +-
.../EventListener/AST/FeatureListener.php | 2 +-
.../EventListener/AST/OutlineListener.php | 2 +-
.../AST/OutlineTableListener.php | 2 +-
.../AST/ScenarioNodeListener.php | 2 +-
.../Node/EventListener/AST/StepListener.php | 2 +-
.../Node/EventListener/AST/SuiteListener.php | 2 +-
.../Flow/FireOnlySiblingsListener.php | 2 +-
.../FirstBackgroundFiresFirstListener.php | 2 +-
.../Flow/OnlyFirstBackgroundFiresListener.php | 2 +-
.../JUnit/JUnitDurationListener.php | 2 +-
.../JUnit/JUnitFeatureElementListener.php | 2 +-
.../JUnit/JUnitOutlineStoreListener.php | 2 +-
.../Statistics/HookStatsListener.php | 2 +-
.../Statistics/ScenarioStatsListener.php | 2 +-
.../Statistics/StatisticsListener.php | 2 +-
.../Statistics/StepStatsListener.php | 2 +-
.../Output/Node/Printer/CounterPrinter.php | 6 ++--
.../Behat/Output/Node/Printer/ListPrinter.php | 2 +-
.../Snippet/Printer/ConsoleSnippetPrinter.php | 2 +-
.../RepositoryArgumentTransformer.php | 2 +-
.../Event/ExerciseCompleted.php | 2 +-
.../EventDispatcher/Event/LifecycleEvent.php | 2 +-
.../Tester/EventDispatchingExercise.php | 8 ++---
.../Tester/EventDispatchingSuiteTester.php | 8 ++---
.../TestworkEventDispatcher.php | 8 ++---
.../Node/EventListener/ChainEventListener.php | 2 +-
.../Node/EventListener/EventListener.php | 2 +-
.../FireOnlyIfFormatterParameterListener.php | 2 +-
.../Output/NodeEventListeningFormatter.php | 2 +-
.../Configuration/ConfigurationTree.php | 4 +--
41 files changed, 93 insertions(+), 82 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index ff05889f1..8fd7b725c 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -38,6 +38,14 @@ class FeatureContext implements Context
* @var string
*/
private $options = '--format-settings=\'{"timer": false}\' --no-interaction';
+ /**
+ * @var array
+ */
+ private $env = [];
+ /**
+ * @var string
+ */
+ private $answerString;
/**
* Cleans test folders in the temporary directory.
@@ -71,8 +79,7 @@ public function prepareTestFolders()
}
$this->workingDir = $dir;
$this->phpBin = $php;
- $this->process = new Process(null);
- $this->process->setTimeout(20);
+ $this->process = Process::fromShellCommandline('');
}
/**
@@ -170,7 +177,7 @@ public function fileShouldExist($path)
*/
public function iSetEnvironmentVariable(PyStringNode $value)
{
- $this->process->setEnv(array('BEHAT_PARAMS' => (string) $value));
+ $this->env = array('BEHAT_PARAMS' => (string) $value);
}
/**
@@ -184,8 +191,7 @@ public function iRunBehat($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
- $this->process->setWorkingDirectory($this->workingDir);
- $this->process->setCommandLine(
+ $this->process = Process::fromShellCommandline(
sprintf(
'%s %s %s %s',
$this->phpBin,
@@ -195,6 +201,15 @@ public function iRunBehat($argumentsString = '')
)
);
+ // Prepare the process parameters.
+ $this->process->setTimeout(20);
+ $this->process->setEnv($this->env);
+ $this->process->setWorkingDirectory($this->workingDir);
+
+ if (!empty($this->answerString)) {
+ $this->process->setInput($this->answerString);
+ }
+
// Don't reset the LANG variable on HHVM, because it breaks HHVM itself
if (!defined('HHVM_VERSION')) {
$env = $this->process->getEnv();
@@ -215,11 +230,9 @@ public function iRunBehat($argumentsString = '')
*/
public function iRunBehatInteractively($answerString, $argumentsString)
{
- $env = $this->process->getEnv();
- $env['SHELL_INTERACTIVE'] = true;
+ $this->env['SHELL_INTERACTIVE'] = true;
- $this->process->setEnv($env);
- $this->process->setInput($answerString);
+ $this->answerString = $answerString;
$this->options = '--format-settings=\'{"timer": false}\'';
$this->iRunBehat($argumentsString);
diff --git a/src/Behat/Behat/Context/Cli/ContextSnippetsController.php b/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
index 3a6edf63c..c13d3436b 100644
--- a/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
+++ b/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
@@ -22,7 +22,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Configures which context snippets are generated for.
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 5f3791743..17a29b9f4 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -16,7 +16,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Interactive identifier that asks user for input.
diff --git a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
index 3192a3d8e..ed3c3cb33 100644
--- a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
+++ b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
@@ -12,7 +12,8 @@
use Behat\Behat\Definition\Definition;
use Behat\Testwork\Suite\Suite;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorTrait;
/**
* Translates definitions using translator component.
@@ -21,6 +22,8 @@
*/
final class DefinitionTranslator
{
+ use TranslatorTrait;
+
/**
* @var TranslatorInterface
*/
@@ -57,9 +60,4 @@ public function translateDefinition(Suite $suite, Definition $definition, $langu
return $definition;
}
-
- public function getLocale()
- {
- return $this->translator->getLocale();
- }
}
diff --git a/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php b/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
index d86b34573..940ac09fd 100644
--- a/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
+++ b/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
@@ -100,8 +100,8 @@ public function exitOnFailure(AfterScenarioTested $event)
return;
}
- $this->eventDispatcher->dispatch(SuiteTested::AFTER, new AfterSuiteAborted($event->getEnvironment()));
- $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());
+ $this->eventDispatcher->dispatch(new AfterSuiteAborted($event->getEnvironment()), SuiteTested::AFTER);
+ $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
exit(1);
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
index d947df55d..e0732d818 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
@@ -55,12 +55,12 @@ public function __construct(BackgroundTester $baseTester, EventDispatcherInterfa
public function setUp(Environment $env, FeatureNode $feature, $skip)
{
$event = new BeforeBackgroundTested($env, $feature, $feature->getBackground());
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseTester->setUp($env, $feature, $skip);
$event = new AfterBackgroundSetup($env, $feature, $feature->getBackground(), $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -79,12 +79,12 @@ public function test(Environment $env, FeatureNode $feature, $skip)
public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result)
{
$event = new BeforeBackgroundTeardown($env, $feature, $feature->getBackground(), $result);
- $this->eventDispatcher->dispatch(BackgroundTested::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN);
$teardown = $this->baseTester->tearDown($env, $feature, $skip, $result);
$event = new AfterBackgroundTested($env, $feature, $feature->getBackground(), $result, $teardown);
- $this->eventDispatcher->dispatch(BackgroundTested::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, BackgroundTested::AFTER);
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
index 2bd0ad5dd..088a4d6d1 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
@@ -53,12 +53,12 @@ public function __construct(SpecificationTester $baseTester, EventDispatcherInte
public function setUp(Environment $env, $feature, $skip)
{
$event = new BeforeFeatureTested($env, $feature);
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseTester->setUp($env, $feature, $skip);
$event = new AfterFeatureSetup($env, $feature, $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -77,12 +77,12 @@ public function test(Environment $env, $feature, $skip)
public function tearDown(Environment $env, $feature, $skip, TestResult $result)
{
$event = new BeforeFeatureTeardown($env, $feature, $result);
- $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
$teardown = $this->baseTester->tearDown($env, $feature, $skip, $result);
$event = new AfterFeatureTested($env, $feature, $result, $teardown);
- $this->eventDispatcher->dispatch($event::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
index 13d257cef..24b3f9898 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
@@ -55,12 +55,12 @@ public function __construct(OutlineTester $baseTester, EventDispatcherInterface
public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip)
{
$event = new BeforeOutlineTested($env, $feature, $outline);
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseTester->setUp($env, $feature, $outline, $skip);
$event = new AfterOutlineSetup($env, $feature, $outline, $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -79,12 +79,12 @@ public function test(Environment $env, FeatureNode $feature, OutlineNode $outlin
public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result)
{
$event = new BeforeOutlineTeardown($env, $feature, $outline, $result);
- $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
$teardown = $this->baseTester->tearDown($env, $feature, $outline, $skip, $result);
$event = new AfterOutlineTested($env, $feature, $outline, $result, $teardown);
- $this->eventDispatcher->dispatch($event::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
index 44eb13120..85c182e6e 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
@@ -85,12 +85,12 @@ public function __construct(
public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip)
{
$event = new BeforeScenarioTested($env, $feature, $scenario);
- $this->eventDispatcher->dispatch($this->beforeEventName, $event);
+ $this->eventDispatcher->dispatch($event, $this->beforeEventName);
$setup = $this->baseTester->setUp($env, $feature, $scenario, $skip);
$event = new AfterScenarioSetup($env, $feature, $scenario, $setup);
- $this->eventDispatcher->dispatch($this->afterSetupEventName, $event);
+ $this->eventDispatcher->dispatch($event, $this->afterSetupEventName);
return $setup;
}
@@ -109,12 +109,12 @@ public function test(Environment $env, FeatureNode $feature, Scenario $scenario,
public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result)
{
$event = new BeforeScenarioTeardown($env, $feature, $scenario, $result);
- $this->eventDispatcher->dispatch($this->beforeTeardownEventName, $event);
+ $this->eventDispatcher->dispatch($event, $this->beforeTeardownEventName);
$teardown = $this->baseTester->tearDown($env, $feature, $scenario, $skip, $result);
$event = new AfterScenarioTested($env, $feature, $scenario, $result, $teardown);
- $this->eventDispatcher->dispatch($this->afterEventName, $event);
+ $this->eventDispatcher->dispatch($event, $this->afterEventName);
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
index 6bf3c46b2..03337556d 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
@@ -55,12 +55,12 @@ public function __construct(StepTester $baseTester, EventDispatcherInterface $ev
public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip)
{
$event = new BeforeStepTested($env, $feature, $step);
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseTester->setUp($env, $feature, $step, $skip);
$event = new AfterStepSetup($env, $feature, $step, $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -79,12 +79,12 @@ public function test(Environment $env, FeatureNode $feature, StepNode $step, $sk
public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result)
{
$event = new BeforeStepTeardown($env, $feature, $step, $result);
- $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
$teardown = $this->baseTester->tearDown($env, $feature, $step, $skip, $result);
$event = new AfterStepTested($env, $feature, $step, $result, $teardown);
- $this->eventDispatcher->dispatch($event::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
return $teardown;
}
diff --git a/src/Behat/Behat/Gherkin/Cli/SyntaxController.php b/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
index a3e3f6cfc..88397c4b3 100644
--- a/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
+++ b/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
@@ -17,7 +17,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Prints example of the feature to present all available syntax keywords.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
index 13bc0a415..8cc4a1e7a 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
@@ -17,7 +17,7 @@
use Behat\Behat\Output\Node\Printer\SetupPrinter;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to feature events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
index bacb12f3a..5881b26c0 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
@@ -24,7 +24,7 @@
use Behat\Gherkin\Node\ExampleNode;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to expanded outline events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
index 9882b7c64..7c0607f89 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
@@ -27,7 +27,7 @@
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Tester\Setup\Setup;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to outline table events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
index 77ac28e70..17d455d0d 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
@@ -17,7 +17,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to scenario events and calls appropriate printers (header/footer).
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
index 0d62a56ef..7392e3448 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
@@ -20,7 +20,7 @@
use Behat\Gherkin\Node\ScenarioLikeInterface;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to step events and call appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
index 8e116e06d..a679fe852 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
@@ -15,7 +15,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat suite listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
index 0a4c85674..fad3c179d 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
@@ -12,7 +12,7 @@
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat fire only siblings listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
index 271b8e580..60200b432 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
@@ -17,7 +17,7 @@
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat first background fires first listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
index 2af5ba2d9..1c4c74bfb 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
@@ -16,7 +16,7 @@
use Behat\Behat\EventDispatcher\Event\FeatureTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat only first background fires listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
index 2c7372103..b70789a8c 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
@@ -11,7 +11,7 @@
use Behat\Testwork\Counter\Timer;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
final class JUnitDurationListener implements EventListener
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
index 465efb6ab..479032245 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
@@ -25,7 +25,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterSetup;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to feature, scenario and step events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
index 4458ebb73..e16708684 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
@@ -18,7 +18,7 @@
use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens for Outline events store the current one
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
index a8d6007b9..92040a7ff 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
@@ -20,7 +20,7 @@
use Behat\Testwork\Hook\Tester\Setup\HookedTeardown;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records hook stats.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
index f83a38f78..c51982e4c 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
@@ -17,7 +17,7 @@
use Behat\Behat\Output\Statistics\Statistics;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records scenario events to the statistics.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
index 1845e1b64..f5a4f0065 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
@@ -15,7 +15,7 @@
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Collects general suite stats such as time and memory during its execution and prints it afterwards.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
index 2f84d052b..2cfcfcf94 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
@@ -26,7 +26,7 @@
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Tester\Result\ExceptionResult;
use Exception;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records step events to statistics.
diff --git a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
index ff567dba3..b6db04fdc 100644
--- a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
@@ -12,7 +12,7 @@
use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter;
use Behat\Testwork\Output\Printer\OutputPrinter;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat counter printer.
@@ -64,12 +64,12 @@ public function printCounters(OutputPrinter $printer, $intro, array $stats)
$style = $this->resultConverter->convertResultCodeToString($resultCode);
$transId = $style . '_count';
- $message = $this->translator->transChoice($transId, $count, array('%1%' => $count), 'output');
+ $message = $this->translator->trans($transId, array('%1%' => $count), 'output');
$detailedStats[] = sprintf('{+%s}%s{-%s}', $style, $message, $style);
}
- $message = $this->translator->transChoice($intro, $totalCount, array('%1%' => $totalCount), 'output');
+ $message = $this->translator->trans($intro, array('%1%' => $totalCount), 'output');
$printer->write($message);
if (count($detailedStats)) {
diff --git a/src/Behat/Behat/Output/Node/Printer/ListPrinter.php b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
index 31e8388ee..41f92ce97 100644
--- a/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
@@ -18,7 +18,7 @@
use Behat\Testwork\Exception\ExceptionPresenter;
use Behat\Testwork\Output\Printer\OutputPrinter;
use Behat\Testwork\Tester\Result\TestResult;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat list printer.
diff --git a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
index 7a5b36e74..e32d17610 100644
--- a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
+++ b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
@@ -14,7 +14,7 @@
use Behat\Gherkin\Node\StepNode;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat console-based snippet printer.
diff --git a/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php b/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
index 795f42fae..02b889f7b 100644
--- a/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
+++ b/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
@@ -19,7 +19,7 @@
use Behat\Behat\Transformation\TransformationRepository;
use Behat\Gherkin\Node\ArgumentInterface;
use Behat\Testwork\Call\CallCenter;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Argument transformer based on transformations repository.
diff --git a/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php b/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php
index 026592bdc..614c06196 100644
--- a/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php
+++ b/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php
@@ -11,7 +11,7 @@
namespace Behat\Testwork\EventDispatcher\Event;
use Behat\Testwork\Specification\SpecificationIterator;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Represents an exercise event.
diff --git a/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php b/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php
index 50191b463..96e1820e8 100644
--- a/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php
+++ b/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php
@@ -12,7 +12,7 @@
use Behat\Testwork\Environment\Environment;
use Behat\Testwork\Suite\Suite;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Represents an event which holds references to current suite and environment.
diff --git a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
index 10f34196e..38b0b36cf 100644
--- a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
+++ b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
@@ -52,12 +52,12 @@ public function __construct(Exercise $baseExercise, EventDispatcherInterface $ev
public function setUp(array $iterators, $skip)
{
$event = new BeforeExerciseCompleted($iterators);
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseExercise->setUp($iterators, $skip);
$event = new AfterExerciseSetup($iterators, $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -76,12 +76,12 @@ public function test(array $iterators, $skip = false)
public function tearDown(array $iterators, $skip, TestResult $result)
{
$event = new BeforeExerciseTeardown($iterators, $result);
- $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
$teardown = $this->baseExercise->tearDown($iterators, $skip, $result);
$event = new AfterExerciseCompleted($iterators, $result, $teardown);
- $this->eventDispatcher->dispatch($event::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
return $teardown;
}
diff --git a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
index 84b2d07c0..3dbeae502 100644
--- a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
+++ b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
@@ -54,12 +54,12 @@ public function __construct(SuiteTester $baseTester, EventDispatcherInterface $e
public function setUp(Environment $env, SpecificationIterator $iterator, $skip)
{
$event = new BeforeSuiteTested($env, $iterator);
- $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
$setup = $this->baseTester->setUp($env, $iterator, $skip);
$event = new AfterSuiteSetup($env, $iterator, $setup);
- $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
return $setup;
}
@@ -78,12 +78,12 @@ public function test(Environment $env, SpecificationIterator $iterator, $skip =
public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result)
{
$event = new BeforeSuiteTeardown($env, $iterator, $result);
- $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
$teardown = $this->baseTester->tearDown($env, $iterator, $skip, $result);
$event = new AfterSuiteTested($env, $iterator, $result, $teardown);
- $this->eventDispatcher->dispatch($event::AFTER, $event);
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
return $teardown;
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index c1200f300..890b157ed 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -10,7 +10,7 @@
namespace Behat\Testwork\EventDispatcher;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
@@ -26,7 +26,7 @@ final class TestworkEventDispatcher extends EventDispatcher
/**
* {@inheritdoc}
*/
- public function dispatch($eventName, Event $event = null)
+ public function dispatch(object $event, string $eventName = null): object
{
if (null === $event) {
$event = new Event();
@@ -36,7 +36,7 @@ public function dispatch($eventName, Event $event = null)
$event->setName($eventName);
}
- $this->doDispatch($this->getListeners($eventName), $eventName, $event);
+ $this->callListeners($this->getListeners($eventName), $eventName, $event);
return $event;
}
@@ -44,7 +44,7 @@ public function dispatch($eventName, Event $event = null)
/**
* {@inheritdoc}
*/
- public function getListeners($eventName = null)
+ public function getListeners(string $eventName = null)
{
if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
return parent::getListeners($eventName);
diff --git a/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php b/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
index 0c76bac39..76695753a 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
@@ -14,7 +14,7 @@
use Behat\Testwork\Output\Formatter;
use Countable;
use IteratorAggregate;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to compose formatter event listeners.
diff --git a/src/Behat/Testwork/Output/Node/EventListener/EventListener.php b/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
index 6fbc078ff..e6145265c 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
@@ -11,7 +11,7 @@
namespace Behat\Testwork\Output\Node\EventListener;
use Behat\Testwork\Output\Formatter;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to define formatter event listeners.
diff --git a/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php b/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
index 0df21eb3a..bbc8d136e 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
@@ -12,7 +12,7 @@
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Catches all events, but proxies them only if formatter has specific parameter set to a specific value.
diff --git a/src/Behat/Testwork/Output/NodeEventListeningFormatter.php b/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
index 3894d49fa..8e5c32a04 100644
--- a/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
+++ b/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
@@ -13,7 +13,7 @@
use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Output\Printer\OutputPrinter;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Formatter built around the idea of event delegation and composition.
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
index d713cbc9b..445266716 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
@@ -30,8 +30,8 @@ final class ConfigurationTree
*/
public function getConfigTree(array $extensions)
{
- $tree = new TreeBuilder();
- $root = $tree->root('testwork');
+ $tree = new TreeBuilder('testwork');
+ $root = $tree->getRootNode();
foreach ($extensions as $extension) {
$extension->configure($root->children()->arrayNode($extension->getConfigKey()));
From 353770f067a957b2ab8c94fe43a09339eb18b5de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sat, 23 Nov 2019 16:23:52 +0100
Subject: [PATCH 172/567] Fix to use the correct placeholder in the
internationalization
---
i18n.php | 254 +++++++++---------
.../Cli/InteractiveContextIdentifier.php | 2 +-
.../Output/Node/Printer/CounterPrinter.php | 4 +-
.../Snippet/Printer/ConsoleSnippetPrinter.php | 4 +-
.../Testwork/Cli/DumpReferenceCommand.php | 2 +
5 files changed, 134 insertions(+), 132 deletions(-)
diff --git a/i18n.php b/i18n.php
index 44eda3c91..393181d39 100644
--- a/i18n.php
+++ b/i18n.php
@@ -1,217 +1,217 @@
array(
- 'snippet_context_choice' => '%1% suite has undefined steps. Please choose the context to generate snippets:',
- 'snippet_proposal_title' => '%1% has missing steps. Define them with these snippets:',
- 'snippet_missing_title' => 'Use --snippets-for CLI option to generate snippets for following %1% suite steps:',
+ 'snippet_context_choice' => '%count% suite has undefined steps. Please choose the context to generate snippets:',
+ 'snippet_proposal_title' => '%count% has missing steps. Define them with these snippets:',
+ 'snippet_missing_title' => 'Use --snippets-for CLI option to generate snippets for following %count% suite steps:',
'skipped_scenarios_title' => 'Skipped scenarios:',
'failed_scenarios_title' => 'Failed scenarios:',
'failed_hooks_title' => 'Failed hooks:',
'failed_steps_title' => 'Failed steps:',
'pending_steps_title' => 'Pending steps:',
- 'scenarios_count' => '{0} No scenarios|{1} 1 scenario|]1,Inf] %1% scenarios',
- 'steps_count' => '{0} No steps|{1} 1 step|]1,Inf] %1% steps',
- 'passed_count' => '[1,Inf] %1% passed',
- 'failed_count' => '[1,Inf] %1% failed',
- 'pending_count' => '[1,Inf] %1% pending',
- 'undefined_count' => '[1,Inf] %1% undefined',
- 'skipped_count' => '[1,Inf] %1% skipped',
+ 'scenarios_count' => '{0} No scenarios|{1} 1 scenario|]1,Inf] %count% scenarios',
+ 'steps_count' => '{0} No steps|{1} 1 step|]1,Inf] %count% steps',
+ 'passed_count' => '[1,Inf] %count% passed',
+ 'failed_count' => '[1,Inf] %count% failed',
+ 'pending_count' => '[1,Inf] %count% pending',
+ 'undefined_count' => '[1,Inf] %count% undefined',
+ 'skipped_count' => '[1,Inf] %count% skipped',
),
'cs' => array(
- 'snippet_proposal_title' => '%1% obsahuje chybné kroky. Definujte je za použità následujÃcÃho kódu:',
- 'snippet_missing_title' => 'Snippety pro následujÃcà kroky v sadÄ› %1% nebyly vygenerovány (zkontrolujte správnost konfigurace):',
+ 'snippet_proposal_title' => '%count% obsahuje chybné kroky. Definujte je za použità následujÃcÃho kódu:',
+ 'snippet_missing_title' => 'Snippety pro následujÃcà kroky v sadÄ› %count% nebyly vygenerovány (zkontrolujte správnost konfigurace):',
'failed_scenarios_title' => 'Chybné scénáře:',
'failed_hooks_title' => 'Chybné hooky:',
'failed_steps_title' => 'Chybné kroky:',
'pending_steps_title' => 'ÄŒekajÃcà kroky:',
- 'scenarios_count' => '{0} Žádný scénář|{1} 1 scénář|{2,3,4} %1% scénáře|]4,Inf] %1% scénářů',
- 'steps_count' => '{0} Žádné kroky|{1} 1 krok|{2,3,4} %1% kroky|]4,Inf] %1% kroků',
- 'passed_count' => '{1} %1% prošel|{2,3,4} %1% prošly|]4,Inf] %1% prošlo',
- 'failed_count' => '{1} %1% selhal|{2,3,4} %1% selhaly|]4,Inf] %1% selhalo',
- 'pending_count' => '{1} %1% Äeká|{2,3,4} %1% ÄekajÃ|]4,Inf] %1% Äeká',
- 'undefined_count' => '{1} %1% nedefinován|{2,3,4} %1% nedefinovány|]4,Inf] %1% nedefinováno',
- 'skipped_count' => '{1} %1% pÅ™eskoÄen|{2,3,4} %1% pÅ™eskoÄeny|]4,Inf] %1% pÅ™eskoÄeno',
+ 'scenarios_count' => '{0} Žádný scénář|{1} 1 scénář|{2,3,4} %count% scénáře|]4,Inf] %count% scénářů',
+ 'steps_count' => '{0} Žádné kroky|{1} 1 krok|{2,3,4} %count% kroky|]4,Inf] %count% kroků',
+ 'passed_count' => '{1} %count% prošel|{2,3,4} %count% prošly|]4,Inf] %count% prošlo',
+ 'failed_count' => '{1} %count% selhal|{2,3,4} %count% selhaly|]4,Inf] %count% selhalo',
+ 'pending_count' => '{1} %count% Äeká|{2,3,4} %count% ÄekajÃ|]4,Inf] %count% Äeká',
+ 'undefined_count' => '{1} %count% nedefinován|{2,3,4} %count% nedefinovány|]4,Inf] %count% nedefinováno',
+ 'skipped_count' => '{1} %count% pÅ™eskoÄen|{2,3,4} %count% pÅ™eskoÄeny|]4,Inf] %count% pÅ™eskoÄeno',
),
'de' => array(
- 'snippet_proposal_title' => '%1% hat fehlende Schritte. Definiere diese mit den folgenden Snippets:',
- 'snippet_missing_title' => 'Snippets für die folgenden Schritte in der %1% Suite wurden nicht generiert (Konfiguration überprüfen):',
+ 'snippet_proposal_title' => '%count% hat fehlende Schritte. Definiere diese mit den folgenden Snippets:',
+ 'snippet_missing_title' => 'Snippets für die folgenden Schritte in der %count% Suite wurden nicht generiert (Konfiguration überprüfen):',
'failed_scenarios_title' => 'Fehlgeschlagene Szenarien:',
'failed_hooks_title' => 'Fehlgeschlagene Hooks:',
'failed_steps_title' => 'Fehlgeschlagene Schritte:',
'pending_steps_title' => 'Ausstehende Schritte:',
- 'scenarios_count' => '{0} Kein Szenario|{1} 1 Szenario|]1,Inf] %1% Szenarien',
- 'steps_count' => '{0} Kein Schritt|{1} 1 Schritt|]1,Inf] %1% Schritte',
- 'passed_count' => '[1,Inf] %1% bestanden',
- 'failed_count' => '[1,Inf] %1% fehlgeschlagen',
- 'pending_count' => '[1,Inf] %1% ausstehend',
- 'undefined_count' => '[1,Inf] %1% nicht definiert',
- 'skipped_count' => '[1,Inf] %1% übersprungen',
+ 'scenarios_count' => '{0} Kein Szenario|{1} 1 Szenario|]1,Inf] %count% Szenarien',
+ 'steps_count' => '{0} Kein Schritt|{1} 1 Schritt|]1,Inf] %count% Schritte',
+ 'passed_count' => '[1,Inf] %count% bestanden',
+ 'failed_count' => '[1,Inf] %count% fehlgeschlagen',
+ 'pending_count' => '[1,Inf] %count% ausstehend',
+ 'undefined_count' => '[1,Inf] %count% nicht definiert',
+ 'skipped_count' => '[1,Inf] %count% übersprungen',
),
'es' => array(
- 'snippet_proposal_title' => 'A %1% le faltan pasos. DefÃnelos con estos pasos:',
- 'snippet_missing_title' => 'Las plantillas para los siguientes pasos en %1% no fueron generadas (revisa tu configuración):',
+ 'snippet_proposal_title' => 'A %count% le faltan pasos. DefÃnelos con estos pasos:',
+ 'snippet_missing_title' => 'Las plantillas para los siguientes pasos en %count% no fueron generadas (revisa tu configuración):',
'failed_scenarios_title' => 'Escenarios fallidos:',
'failed_hooks_title' => 'Hooks fallidos:',
'failed_steps_title' => 'Pasos fallidos:',
'pending_steps_title' => 'Pasos pendientes:',
- 'scenarios_count' => '{0} Ningún escenario|{1} 1 escenario|]1,Inf] %1% escenarios',
- 'steps_count' => '{0} Ningún paso|{1} 1 paso|]1,Inf] %1% pasos',
- 'passed_count' => '[1,Inf] %1% pasaron',
- 'failed_count' => '[1,Inf] %1% fallaron',
- 'pending_count' => '[1,Inf] %1% pendientes',
- 'undefined_count' => '[1,Inf] %1% por definir',
- 'skipped_count' => '[1,Inf] %1% saltadas',
+ 'scenarios_count' => '{0} Ningún escenario|{1} 1 escenario|]1,Inf] %count% escenarios',
+ 'steps_count' => '{0} Ningún paso|{1} 1 paso|]1,Inf] %count% pasos',
+ 'passed_count' => '[1,Inf] %count% pasaron',
+ 'failed_count' => '[1,Inf] %count% fallaron',
+ 'pending_count' => '[1,Inf] %count% pendientes',
+ 'undefined_count' => '[1,Inf] %count% por definir',
+ 'skipped_count' => '[1,Inf] %count% saltadas',
),
'fr' => array(
- 'snippet_proposal_title' => '%1% a des étapes manquantes. Définissez-les avec les modèles suivants :',
- 'snippet_missing_title' => 'Les modèles des étapes de la suite %1% n\'ont pas été générés (vérifiez votre configuration):',
+ 'snippet_proposal_title' => '%count% a des étapes manquantes. Définissez-les avec les modèles suivants :',
+ 'snippet_missing_title' => 'Les modèles des étapes de la suite %count% n\'ont pas été générés (vérifiez votre configuration):',
'failed_scenarios_title' => 'Scénarios échoués:',
'failed_hooks_title' => 'Hooks échoués:',
'failed_steps_title' => 'Etapes échouées:',
'pending_steps_title' => 'Etapes en attente:',
- 'scenarios_count' => '{0} Pas de scénario|{1} 1 scénario|]1,Inf] %1% scénarios',
- 'steps_count' => '{0} Pas d\'étape|{1} 1 étape|]1,Inf] %1% étapes',
- 'passed_count' => '[1,Inf] %1% succès',
- 'failed_count' => '[1,Inf] %1% échecs',
- 'pending_count' => '[1,Inf] %1% en attente',
- 'undefined_count' => '[1,Inf] %1% indéfinis',
- 'skipped_count' => '[1,Inf] %1% ignorés',
+ 'scenarios_count' => '{0} Pas de scénario|{1} 1 scénario|]1,Inf] %count% scénarios',
+ 'steps_count' => '{0} Pas d\'étape|{1} 1 étape|]1,Inf] %count% étapes',
+ 'passed_count' => '[1,Inf] %count% succès',
+ 'failed_count' => '[1,Inf] %count% échecs',
+ 'pending_count' => '[1,Inf] %count% en attente',
+ 'undefined_count' => '[1,Inf] %count% indéfinis',
+ 'skipped_count' => '[1,Inf] %count% ignorés',
),
'it' => array(
- 'snippet_proposal_title' => '%1% ha dei passaggi mancanti. Definiscili con questi snippet:',
- 'snippet_missing_title' => 'Gli snippet per i seguenti passaggi della suite %1% non sono stati generati (verifica la configurazione):',
+ 'snippet_proposal_title' => '%count% ha dei passaggi mancanti. Definiscili con questi snippet:',
+ 'snippet_missing_title' => 'Gli snippet per i seguenti passaggi della suite %count% non sono stati generati (verifica la configurazione):',
'failed_scenarios_title' => 'Scenari falliti:',
'failed_hooks_title' => 'Hook falliti:',
'failed_steps_title' => 'Passaggi falliti:',
'pending_steps_title' => 'Passaggi in sospeso:',
- 'scenarios_count' => '{0} Nessuno scenario|{1} 1 scenario|]1,Inf] %1% scenari',
- 'steps_count' => '{0} Nessun passaggio|{1} 1 passaggio|]1,Inf] %1% passaggi',
- 'passed_count' => '{1} 1 superato|]1,Inf] %1% superati',
- 'failed_count' => '{1} 1 fallito|]1,Inf] %1% falliti',
- 'pending_count' => '[1,Inf] %1% in sospeso',
- 'undefined_count' => '{1} 1 non definito|]1,Inf] %1% non definiti',
- 'skipped_count' => '{1} 1 ignorato|]1,Inf] %1% ignorati',
+ 'scenarios_count' => '{0} Nessuno scenario|{1} 1 scenario|]1,Inf] %count% scenari',
+ 'steps_count' => '{0} Nessun passaggio|{1} 1 passaggio|]1,Inf] %count% passaggi',
+ 'passed_count' => '{1} 1 superato|]1,Inf] %count% superati',
+ 'failed_count' => '{1} 1 fallito|]1,Inf] %count% falliti',
+ 'pending_count' => '[1,Inf] %count% in sospeso',
+ 'undefined_count' => '{1} 1 non definito|]1,Inf] %count% non definiti',
+ 'skipped_count' => '{1} 1 ignorato|]1,Inf] %count% ignorati',
),
'ja' => array(
- 'snippet_proposal_title' => '%1% ã®ã‚¹ãƒ†ãƒƒãƒ—ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 次ã®ã‚¹ãƒ‹ãƒšãƒƒãƒˆã§å®šç¾©ã§ãã¾ã™:',
- 'snippet_missing_title' => '以下ã®ã‚¹ãƒ†ãƒƒãƒ—ã®ã‚¹ãƒ‹ãƒšãƒƒãƒˆã¯%1%スイートã«ç”Ÿæˆã•ã‚Œã¾ã›ã‚“ã§ã—ãŸ(è¨å®šã‚’確èªã—ã¦ãã ã•ã„):',
+ 'snippet_proposal_title' => '%count% ã®ã‚¹ãƒ†ãƒƒãƒ—ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“。 次ã®ã‚¹ãƒ‹ãƒšãƒƒãƒˆã§å®šç¾©ã§ãã¾ã™:',
+ 'snippet_missing_title' => '以下ã®ã‚¹ãƒ†ãƒƒãƒ—ã®ã‚¹ãƒ‹ãƒšãƒƒãƒˆã¯%count%スイートã«ç”Ÿæˆã•ã‚Œã¾ã›ã‚“ã§ã—ãŸ(è¨å®šã‚’確èªã—ã¦ãã ã•ã„):',
'skipped_scenarios_title' => 'スã‚ップã—㟠シナリオ:',
'failed_scenarios_title' => '失敗ã—㟠シナリオ:',
'failed_hooks_title' => '失敗ã—㟠フック:',
'failed_steps_title' => '失敗ã—㟠ステップ:',
'pending_steps_title' => 'ä¿ç•™ä¸ã®ã‚¹ãƒ†ãƒƒãƒ—:',
- 'scenarios_count' => '{0} No scenarios|{1} 1 個ã®ã‚·ãƒŠãƒªã‚ª|]1,Inf] %1% 個ã®ã‚·ãƒŠãƒªã‚ª',
- 'steps_count' => '{0} ステップãŒã‚ã‚Šã¾ã›ã‚“|{1} 1 個ã®ã‚¹ãƒ†ãƒƒãƒ—|]1,Inf] %1% 個ã®ã‚¹ãƒ†ãƒƒãƒ—',
- 'passed_count' => '[1,Inf] %1% 個æˆåŠŸ',
- 'failed_count' => '[1,Inf] %1% 個失敗',
- 'pending_count' => '[1,Inf] %1% 個ä¿ç•™',
- 'undefined_count' => '[1,Inf] %1% 個未定義',
- 'skipped_count' => '[1,Inf] %1% 個スã‚ップ',
+ 'scenarios_count' => '{0} No scenarios|{1} 1 個ã®ã‚·ãƒŠãƒªã‚ª|]1,Inf] %count% 個ã®ã‚·ãƒŠãƒªã‚ª',
+ 'steps_count' => '{0} ステップãŒã‚ã‚Šã¾ã›ã‚“|{1} 1 個ã®ã‚¹ãƒ†ãƒƒãƒ—|]1,Inf] %count% 個ã®ã‚¹ãƒ†ãƒƒãƒ—',
+ 'passed_count' => '[1,Inf] %count% 個æˆåŠŸ',
+ 'failed_count' => '[1,Inf] %count% 個失敗',
+ 'pending_count' => '[1,Inf] %count% 個ä¿ç•™',
+ 'undefined_count' => '[1,Inf] %count% 個未定義',
+ 'skipped_count' => '[1,Inf] %count% 個スã‚ップ',
),
'nl' => array(
- 'snippet_proposal_title' => 'Ontbrekende stappen in %1%. Definieer ze met de volgende fragmenten:',
- 'snippet_missing_title' => 'Fragmenten voor de volgende stappen in de %1% suite werden niet gegenereerd (controleer de configuratie):',
+ 'snippet_proposal_title' => 'Ontbrekende stappen in %count%. Definieer ze met de volgende fragmenten:',
+ 'snippet_missing_title' => 'Fragmenten voor de volgende stappen in de %count% suite werden niet gegenereerd (controleer de configuratie):',
'failed_scenarios_title' => 'Gefaalde scenario\'s:',
'failed_hooks_title' => 'Gefaalde hooks:',
'failed_steps_title' => 'Gefaalde stappen:',
'pending_steps_title' => 'Onafgewerkte stappen:',
- 'scenarios_count' => '{0} Geen scenario\'s|{1} 1 scenario|]1,Inf] %1% scenario\'s',
- 'steps_count' => '{0} Geen stappen|{1} 1 stap|]1,Inf] %1% stappen',
- 'passed_count' => '[1,Inf] %1% geslaagd',
- 'failed_count' => '[1,Inf] %1% gefaald',
- 'pending_count' => '[1,Inf] %1% wachtende',
- 'undefined_count' => '[1,Inf] %1% niet gedefinieerd',
- 'skipped_count' => '[1,Inf] %1% overgeslagen',
+ 'scenarios_count' => '{0} Geen scenario\'s|{1} 1 scenario|]1,Inf] %count% scenario\'s',
+ 'steps_count' => '{0} Geen stappen|{1} 1 stap|]1,Inf] %count% stappen',
+ 'passed_count' => '[1,Inf] %count% geslaagd',
+ 'failed_count' => '[1,Inf] %count% gefaald',
+ 'pending_count' => '[1,Inf] %count% wachtende',
+ 'undefined_count' => '[1,Inf] %count% niet gedefinieerd',
+ 'skipped_count' => '[1,Inf] %count% overgeslagen',
),
'no' => array(
- 'snippet_proposal_title' => '%1% mangler steg. Definer dem med disse snuttene:',
- 'snippet_missing_title' => 'Snutter for de følgende stegene i %1%-samlingen ble ikke laget. (Sjekk konfigurasjonen din.):',
+ 'snippet_proposal_title' => '%count% mangler steg. Definer dem med disse snuttene:',
+ 'snippet_missing_title' => 'Snutter for de følgende stegene i %count%-samlingen ble ikke laget. (Sjekk konfigurasjonen din.):',
'failed_scenarios_title' => 'Feilende scenarier:',
'failed_hooks_title' => 'Feilende hooks:',
'failed_steps_title' => 'Feilende steg:',
'pending_steps_title' => 'Ikke implementerte steg:',
- 'scenarios_count' => '{0} Ingen scenarier|{1} 1 scenario|]1,Inf] %1% scenarier',
- 'steps_count' => '{0} Ingen steg|{1} 1 steg|]1,Inf] %1% steg',
- 'passed_count' => '[1,Inf] %1% ok',
- 'failed_count' => '[1,Inf] %1% feilet',
- 'pending_count' => '[1,Inf] %1% ikke implementert',
- 'undefined_count' => '[1,Inf] %1% ikke definert',
- 'skipped_count' => '[1,Inf] %1% hoppet over',
+ 'scenarios_count' => '{0} Ingen scenarier|{1} 1 scenario|]1,Inf] %count% scenarier',
+ 'steps_count' => '{0} Ingen steg|{1} 1 steg|]1,Inf] %count% steg',
+ 'passed_count' => '[1,Inf] %count% ok',
+ 'failed_count' => '[1,Inf] %count% feilet',
+ 'pending_count' => '[1,Inf] %count% ikke implementert',
+ 'undefined_count' => '[1,Inf] %count% ikke definert',
+ 'skipped_count' => '[1,Inf] %count% hoppet over',
),
'pl' => array(
- 'snippet_proposal_title' => '%1% zawiera brakujące kroki. Utwórz je korzystając z tych fragmentów kodu:',
- 'snippet_missing_title' => 'Fragmenty kodu dla następujących kroków %1% nie zostały wygenerowane (sprawdź swoją konfigurację):',
+ 'snippet_proposal_title' => '%count% zawiera brakujące kroki. Utwórz je korzystając z tych fragmentów kodu:',
+ 'snippet_missing_title' => 'Fragmenty kodu dla następujących kroków %count% nie zostały wygenerowane (sprawdź swoją konfigurację):',
'failed_scenarios_title' => 'Nieudane scenariusze:',
'failed_hooks_title' => 'Nieudane hooki:',
'failed_steps_title' => 'Nieudane kroki',
'pending_steps_title' => 'OczekujÄ…ce kroki',
- 'scenarios_count' => '{0} Brak scenariuszy|{1} 1 scenariusz|{2,3,4,22,23,24,32,33,34,42,43,44} %1% scenariusze|]4,Inf] %1% scenariuszy',
- 'steps_count' => '{0} Brak kroków|{1} 1 krok|{2,3,4,22,23,24,32,33,34,42,43,44} %1% kroki|]4,Inf] %1% kroków',
- 'passed_count' => '{1} %1% udany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% udane|]4,Inf] %1% udanych',
- 'failed_count' => '{1} %1% nieudany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% nieudane|]4,Inf] %1% nieudanych',
- 'pending_count' => '{1} %1% oczekujÄ…cy|{2,3,4,22,23,24,32,33,34,42,43,44} %1% oczekujÄ…ce|]4,Inf] %1% oczekujÄ…cych',
- 'undefined_count' => '{1} %1% niezdefiniowany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% niezdefiniowane|]4,Inf] %1% niezdefiniowanych',
- 'skipped_count' => '{1} %1% pominięty|{2,3,4,22,23,24,32,33,34,42,43,44} %1% pominięte|]4,Inf] %1% pominiętych',
+ 'scenarios_count' => '{0} Brak scenariuszy|{1} 1 scenariusz|{2,3,4,22,23,24,32,33,34,42,43,44} %count% scenariusze|]4,Inf] %count% scenariuszy',
+ 'steps_count' => '{0} Brak kroków|{1} 1 krok|{2,3,4,22,23,24,32,33,34,42,43,44} %count% kroki|]4,Inf] %count% kroków',
+ 'passed_count' => '{1} %count% udany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% udane|]4,Inf] %count% udanych',
+ 'failed_count' => '{1} %count% nieudany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% nieudane|]4,Inf] %count% nieudanych',
+ 'pending_count' => '{1} %count% oczekujÄ…cy|{2,3,4,22,23,24,32,33,34,42,43,44} %count% oczekujÄ…ce|]4,Inf] %count% oczekujÄ…cych',
+ 'undefined_count' => '{1} %count% niezdefiniowany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% niezdefiniowane|]4,Inf] %count% niezdefiniowanych',
+ 'skipped_count' => '{1} %count% pominięty|{2,3,4,22,23,24,32,33,34,42,43,44} %count% pominięte|]4,Inf] %count% pominiętych',
),
'pt' => array(
- 'snippet_proposal_title' => '%1% contém definições em falta. Defina-as com estes exemplos:',
- 'snippet_missing_title' => 'Os exemplos para as seguintes definições da suite %1% não foram gerados (verifique a configuração):',
+ 'snippet_proposal_title' => '%count% contém definições em falta. Defina-as com estes exemplos:',
+ 'snippet_missing_title' => 'Os exemplos para as seguintes definições da suite %count% não foram gerados (verifique a configuração):',
'failed_scenarios_title' => 'Cenários que falharam:',
'failed_hooks_title' => 'Hooks que falharam:',
'failed_steps_title' => 'Definições que falharam:',
'pending_steps_title' => 'Definições por definir:',
- 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %1% cenários',
- 'steps_count' => '{0} Nenhuma definição|{1} 1 definição|]1,Inf] %1% definições',
- 'passed_count' => '{1} passou|]1,Inf] %1% passaram',
- 'failed_count' => '{1} falhou|]1,Inf] %1% falharam',
- 'pending_count' => '[1,Inf] %1% por definir',
- 'undefined_count' => '{1} indefinido|]1,Inf] %1% indefinidos',
- 'skipped_count' => '{1} omitido|]1,Inf] %1% omitidos',
+ 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %count% cenários',
+ 'steps_count' => '{0} Nenhuma definição|{1} 1 definição|]1,Inf] %count% definições',
+ 'passed_count' => '{1} passou|]1,Inf] %count% passaram',
+ 'failed_count' => '{1} falhou|]1,Inf] %count% falharam',
+ 'pending_count' => '[1,Inf] %count% por definir',
+ 'undefined_count' => '{1} indefinido|]1,Inf] %count% indefinidos',
+ 'skipped_count' => '{1} omitido|]1,Inf] %count% omitidos',
),
'pt-BR' => array(
- 'snippet_proposal_title' => '%1% possue etapas faltando. Defina elas com esse(s) trecho(s) de código:',
- 'snippet_missing_title' => 'Trecho de códigos para as seguintes etapas em %1% suite não foram geradas (verique sua configuração):',
+ 'snippet_proposal_title' => '%count% possue etapas faltando. Defina elas com esse(s) trecho(s) de código:',
+ 'snippet_missing_title' => 'Trecho de códigos para as seguintes etapas em %count% suite não foram geradas (verique sua configuração):',
'failed_scenarios_title' => 'Cenários falhados:',
'failed_hooks_title' => 'Hooks falhados:',
'failed_steps_title' => 'Etapas falhadas:',
'pending_steps_title' => 'Etapas pendentes:',
- 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %1% cenários',
- 'steps_count' => '{0} Nenhuma etapa|{1} 1 etapa|]1,Inf] %1% etapas',
- 'passed_count' => '[1,Inf] %1% passou',
- 'failed_count' => '[1,Inf] %1% falhou',
- 'pending_count' => '[1,Inf] %1% pendente',
- 'undefined_count' => '[1,Inf] %1% indefinido',
- 'skipped_count' => '[1,Inf] %1% pulado',
+ 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %count% cenários',
+ 'steps_count' => '{0} Nenhuma etapa|{1} 1 etapa|]1,Inf] %count% etapas',
+ 'passed_count' => '[1,Inf] %count% passou',
+ 'failed_count' => '[1,Inf] %count% falhou',
+ 'pending_count' => '[1,Inf] %count% pendente',
+ 'undefined_count' => '[1,Inf] %count% indefinido',
+ 'skipped_count' => '[1,Inf] %count% pulado',
),
'ro' => array(
- 'snippet_proposal_title' => '%1% are pași lipsa. Puteți implementa pașii cu ajutorul acestor fragmente de cod:',
- 'snippet_missing_title' => 'Fragmentele de cod pentru urmatorii pași din suita %1% nu au fost generate (contextul tau implementeaza interfata SnippetAcceptingContext?):',
+ 'snippet_proposal_title' => '%count% are pași lipsa. Puteți implementa pașii cu ajutorul acestor fragmente de cod:',
+ 'snippet_missing_title' => 'Fragmentele de cod pentru urmatorii pași din suita %count% nu au fost generate (contextul tau implementeaza interfata SnippetAcceptingContext?):',
'skipped_scenarios_title' => 'Scenarii omise:',
'failed_scenarios_title' => 'Scenarii eșuate:',
'failed_hooks_title' => 'Hook-uri eșuate:',
'failed_steps_title' => 'Pași esuați:',
'pending_steps_title' => 'Pași in așteptare:',
- 'scenarios_count' => '{0} Niciun scenariu|{1} 1 scenariu|]1,Inf] %1% scenarii',
- 'steps_count' => '{0} Niciun pas|{1} 1 pas|]1,Inf] %1% pasi',
- 'passed_count' => '[1,Inf] %1% cu succes',
- 'failed_count' => '[1,Inf] %1% fara success',
- 'pending_count' => '[1,Inf] %1% in așteptare',
- 'undefined_count' => '[1,Inf] %1% fara implementare',
- 'skipped_count' => '{1} %1% omis|]1,Inf] %1% omiși',
+ 'scenarios_count' => '{0} Niciun scenariu|{1} 1 scenariu|]1,Inf] %count% scenarii',
+ 'steps_count' => '{0} Niciun pas|{1} 1 pas|]1,Inf] %count% pasi',
+ 'passed_count' => '[1,Inf] %count% cu succes',
+ 'failed_count' => '[1,Inf] %count% fara success',
+ 'pending_count' => '[1,Inf] %count% in așteptare',
+ 'undefined_count' => '[1,Inf] %count% fara implementare',
+ 'skipped_count' => '{1} %count% omis|]1,Inf] %count% omiși',
),
'ru' => array(
- 'snippet_proposal_title' => '%1% не Ñодержит необходимых определений. Ð’Ñ‹ можете добавить их иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ ÑˆÐ°Ð±Ð»Ð¾Ð½Ñ‹:',
- 'snippet_missing_title' => 'Шаблоны Ð´Ð»Ñ Ñледующих шагов в Ñреде %1% не были Ñгенерированы (проверьте ваши наÑтройки):',
+ 'snippet_proposal_title' => '%count% не Ñодержит необходимых определений. Ð’Ñ‹ можете добавить их иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ ÑˆÐ°Ð±Ð»Ð¾Ð½Ñ‹:',
+ 'snippet_missing_title' => 'Шаблоны Ð´Ð»Ñ Ñледующих шагов в Ñреде %count% не были Ñгенерированы (проверьте ваши наÑтройки):',
'skipped_scenarios_title' => 'Пропущенные Ñценарии:',
'failed_scenarios_title' => 'Проваленные Ñценарии:',
'failed_hooks_title' => 'Проваленные хуки:',
'failed_steps_title' => 'Проваленные шаги:',
'pending_steps_title' => 'Шаги в ожидании:',
- 'scenarios_count' => '{0} Ðет Ñценариев|{1,21,31} %1% Ñценарий|{2,3,4,22,23,24} %1% ÑценариÑ|]4,Inf] %1% Ñценариев',
- 'steps_count' => '{0} Ðет шагов|{1,21,31} %1% шаг|{2,3,4,22,23,24} %1% шага|]4,Inf] %1% шагов',
- 'passed_count' => '{1,21,31} %1% пройден|]1,Inf] %1% пройдено',
- 'failed_count' => '{1,21,31} %1% провален|]1,Inf] %1% провалено',
- 'pending_count' => '[1,Inf] %1% в ожидании',
- 'undefined_count' => '{1,21,31} %1% не определен|]1,Inf] %1% не определено',
- 'skipped_count' => '{1,21,31} %1% пропущен|]1,Inf] %1% пропущено',
+ 'scenarios_count' => '{0} Ðет Ñценариев|{1,21,31} %count% Ñценарий|{2,3,4,22,23,24} %count% ÑценариÑ|]4,Inf] %count% Ñценариев',
+ 'steps_count' => '{0} Ðет шагов|{1,21,31} %count% шаг|{2,3,4,22,23,24} %count% шага|]4,Inf] %count% шагов',
+ 'passed_count' => '{1,21,31} %count% пройден|]1,Inf] %count% пройдено',
+ 'failed_count' => '{1,21,31} %count% провален|]1,Inf] %count% провалено',
+ 'pending_count' => '[1,Inf] %count% в ожидании',
+ 'undefined_count' => '{1,21,31} %count% не определен|]1,Inf] %count% не определено',
+ 'skipped_count' => '{1,21,31} %count% пропущен|]1,Inf] %count% пропущено',
),
);
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 17a29b9f4..447e47098 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -68,7 +68,7 @@ public function guessTargetContextClass(ContextEnvironment $environment)
return null;
}
- $message = $this->translator->trans('snippet_context_choice', array('%1%' => $suiteName), 'output');
+ $message = $this->translator->trans('snippet_context_choice', array('%count%' => $suiteName), 'output');
$choices = array_values(array_merge(array('None'), $contextClasses));
$default = 1;
diff --git a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
index b6db04fdc..47655f20e 100644
--- a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
@@ -64,12 +64,12 @@ public function printCounters(OutputPrinter $printer, $intro, array $stats)
$style = $this->resultConverter->convertResultCodeToString($resultCode);
$transId = $style . '_count';
- $message = $this->translator->trans($transId, array('%1%' => $count), 'output');
+ $message = $this->translator->trans($transId, array('%count%' => $count), 'output');
$detailedStats[] = sprintf('{+%s}%s{-%s}', $style, $message, $style);
}
- $message = $this->translator->trans($intro, array('%1%' => $totalCount), 'output');
+ $message = $this->translator->trans($intro, array('%count%' => $totalCount), 'output');
$printer->write($message);
if (count($detailedStats)) {
diff --git a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
index e32d17610..ec06bc17d 100644
--- a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
+++ b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
@@ -57,7 +57,7 @@ public function __construct(OutputInterface $output, TranslatorInterface $transl
*/
public function printSnippets($targetName, array $snippets)
{
- $message = $this->translator->trans('snippet_proposal_title', array('%1%' => $targetName), 'output');
+ $message = $this->translator->trans('snippet_proposal_title', array('%count%' => $targetName), 'output');
$this->output->writeln('--- ' . $message . PHP_EOL);
@@ -74,7 +74,7 @@ public function printSnippets($targetName, array $snippets)
*/
public function printUndefinedSteps($suiteName, array $steps)
{
- $message = $this->translator->trans('snippet_missing_title', array('%1%' => $suiteName), 'output');
+ $message = $this->translator->trans('snippet_missing_title', array('%count%' => $suiteName), 'output');
$this->output->writeln('--- ' . $message . PHP_EOL);
diff --git a/src/Behat/Testwork/Cli/DumpReferenceCommand.php b/src/Behat/Testwork/Cli/DumpReferenceCommand.php
index d6b57d442..57416d8b7 100644
--- a/src/Behat/Testwork/Cli/DumpReferenceCommand.php
+++ b/src/Behat/Testwork/Cli/DumpReferenceCommand.php
@@ -57,5 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$configTree = new ConfigurationTree();
$output->writeln($dumper->dumpNode($configTree->getConfigTree($this->extensionManager->getExtensions())));
+
+ return 0;
}
}
From 0f3ed3b43cb2763be3719b5db3c5032cc7f47461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sun, 24 Nov 2019 13:02:11 +0100
Subject: [PATCH 173/567] Added the new Symfony version for travis
---
.travis.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 1dc30050e..732e4253e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,8 @@ matrix:
env: SYMFONY_VERSION='^3.4'
- php: 7.3
env: SYMFONY_VERSION='^4.2'
+ - php: 7.3
+ env: SYMFONY_VERSION='^5.0'
before_install:
- phpenv config-rm xdebug.ini || echo "XDebug is not enabled"
From d4fde010458646fb383df833ed9e528df4f689b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sun, 24 Nov 2019 13:08:24 +0100
Subject: [PATCH 174/567] Use the original getLocale() instead of the
TranslatorTrait::getLocale()
---
.../Behat/Definition/Translator/DefinitionTranslator.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
index ed3c3cb33..3423249cb 100644
--- a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
+++ b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
@@ -13,7 +13,6 @@
use Behat\Behat\Definition\Definition;
use Behat\Testwork\Suite\Suite;
use Symfony\Contracts\Translation\TranslatorInterface;
-use Symfony\Contracts\Translation\TranslatorTrait;
/**
* Translates definitions using translator component.
@@ -22,8 +21,6 @@
*/
final class DefinitionTranslator
{
- use TranslatorTrait;
-
/**
* @var TranslatorInterface
*/
@@ -60,4 +57,9 @@ public function translateDefinition(Suite $suite, Definition $definition, $langu
return $definition;
}
+
+ public function getLocale()
+ {
+ return $this->translator->getLocale();
+ }
}
From 51d9dfe4012f4d0ccca5d1879c9f1f1362551bb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 14:39:40 +0100
Subject: [PATCH 175/567] Added BC layer for the TreeBuilder
---
features/bootstrap/FeatureContext.php | 1 -
.../Configuration/ConfigurationTree.php | 15 ++++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 8fd7b725c..6b63074f6 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -79,7 +79,6 @@ public function prepareTestFolders()
}
$this->workingDir = $dir;
$this->phpBin = $php;
- $this->process = Process::fromShellCommandline('');
}
/**
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
index 445266716..cf2fa1936 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
@@ -11,6 +11,7 @@
namespace Behat\Testwork\ServiceContainer\Configuration;
use Behat\Testwork\ServiceContainer\Extension;
+use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\NodeInterface;
@@ -30,11 +31,19 @@ final class ConfigurationTree
*/
public function getConfigTree(array $extensions)
{
- $tree = new TreeBuilder('testwork');
- $root = $tree->getRootNode();
+ if (method_exists(TreeBuilder::class, 'getRootNode')) {
+ $treeBuilder = new TreeBuilder('testwork');
+ /** @var ArrayNodeDefinition $rootNode */
+ $rootNode = $treeBuilder->getRootNode();
+ } else {
+ // BC layer for symfony/config 4.1 and older
+ $treeBuilder = new TreeBuilder();
+ /** @var ArrayNodeDefinition $rootNode */
+ $rootNode = $treeBuilder->root('sylius_resource');
+ }
foreach ($extensions as $extension) {
- $extension->configure($root->children()->arrayNode($extension->getConfigKey()));
+ $extension->configure($rootNode->children()->arrayNode($extension->getConfigKey()));
}
return $tree->buildTree();
From 56439838a845fac7a7fc3f66644487b30cc8bc1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 18:25:03 +0100
Subject: [PATCH 176/567] Added BC layer for older versions of Symfony
---
.../Context/Cli/ContextSnippetsController.php | 2 +-
.../Cli/InteractiveContextIdentifier.php | 2 +-
.../Translator/DefinitionTranslator.php | 1 -
.../Definition/Translator/Translator.php | 15 +++
.../Translator/TranslatorInterface.php | 13 +++
.../Cli/StopOnFailureController.php | 9 +-
.../EventDispatchingBackgroundTester.php | 29 +++++-
.../Tester/EventDispatchingFeatureTester.php | 28 +++++-
.../Tester/EventDispatchingOutlineTester.php | 28 +++++-
.../Tester/EventDispatchingScenarioTester.php | 28 +++++-
.../Tester/EventDispatchingStepTester.php | 28 +++++-
.../Behat/Gherkin/Cli/SyntaxController.php | 2 +-
.../EventListener/AST/FeatureListener.php | 2 +-
.../EventListener/AST/OutlineListener.php | 2 +-
.../AST/OutlineTableListener.php | 2 +-
.../AST/ScenarioNodeListener.php | 2 +-
.../Node/EventListener/AST/StepListener.php | 2 +-
.../Node/EventListener/AST/SuiteListener.php | 2 +-
.../Flow/FireOnlySiblingsListener.php | 2 +-
.../FirstBackgroundFiresFirstListener.php | 2 +-
.../Flow/OnlyFirstBackgroundFiresListener.php | 2 +-
.../JUnit/JUnitDurationListener.php | 2 +-
.../JUnit/JUnitFeatureElementListener.php | 2 +-
.../JUnit/JUnitOutlineStoreListener.php | 2 +-
.../Statistics/HookStatsListener.php | 2 +-
.../Statistics/ScenarioStatsListener.php | 2 +-
.../Statistics/StatisticsListener.php | 2 +-
.../Statistics/StepStatsListener.php | 3 +-
.../Output/Node/Printer/CounterPrinter.php | 2 +-
.../Behat/Output/Node/Printer/ListPrinter.php | 2 +-
.../Snippet/Printer/ConsoleSnippetPrinter.php | 2 +-
.../RepositoryArgumentTransformer.php | 2 +-
src/Behat/Testwork/Event/Event.php | 15 +++
.../Event/ExerciseCompleted.php | 3 +-
.../EventDispatcher/Event/LifecycleEvent.php | 2 +-
.../Tester/EventDispatchingExercise.php | 28 +++++-
.../Tester/EventDispatchingSuiteTester.php | 27 +++++-
.../TestworkEventDispatcher.php | 97 +++++++++++++------
.../Testwork/Exception/ExceptionPresenter.php | 1 -
.../Node/EventListener/ChainEventListener.php | 2 +-
.../Node/EventListener/EventListener.php | 2 +-
.../FireOnlyIfFormatterParameterListener.php | 2 +-
.../Output/NodeEventListeningFormatter.php | 2 +-
.../ServiceContainer/TranslatorExtension.php | 2 +-
44 files changed, 318 insertions(+), 91 deletions(-)
create mode 100644 src/Behat/Behat/Definition/Translator/Translator.php
create mode 100644 src/Behat/Behat/Definition/Translator/TranslatorInterface.php
create mode 100644 src/Behat/Testwork/Event/Event.php
diff --git a/src/Behat/Behat/Context/Cli/ContextSnippetsController.php b/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
index c13d3436b..3bfbc40bd 100644
--- a/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
+++ b/src/Behat/Behat/Context/Cli/ContextSnippetsController.php
@@ -17,12 +17,12 @@
use Behat\Behat\Context\Snippet\Generator\FixedContextIdentifier;
use Behat\Behat\Context\Snippet\Generator\FixedPatternIdentifier;
use Behat\Behat\Context\Snippet\Generator\AggregateContextIdentifier;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Testwork\Cli\Controller;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Configures which context snippets are generated for.
diff --git a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
index 447e47098..137cac797 100644
--- a/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
+++ b/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php
@@ -12,11 +12,11 @@
use Behat\Behat\Context\Environment\ContextEnvironment;
use Behat\Behat\Context\Snippet\Generator\TargetContextIdentifier;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Interactive identifier that asks user for input.
diff --git a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
index 3423249cb..105d61c50 100644
--- a/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
+++ b/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php
@@ -12,7 +12,6 @@
use Behat\Behat\Definition\Definition;
use Behat\Testwork\Suite\Suite;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Translates definitions using translator component.
diff --git a/src/Behat/Behat/Definition/Translator/Translator.php b/src/Behat/Behat/Definition/Translator/Translator.php
new file mode 100644
index 000000000..858e6445d
--- /dev/null
+++ b/src/Behat/Behat/Definition/Translator/Translator.php
@@ -0,0 +1,15 @@
+eventDispatcher->dispatch(new AfterSuiteAborted($event->getEnvironment()), SuiteTested::AFTER);
- $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch(new AfterSuiteAborted($event->getEnvironment()), SuiteTested::AFTER);
+ $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch(SuiteTested::AFTER, new AfterSuiteAborted($event->getEnvironment()));
+ $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());
+ }
exit(1);
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
index e0732d818..7b168f448 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
@@ -55,12 +55,22 @@ public function __construct(BackgroundTester $baseTester, EventDispatcherInterfa
public function setUp(Environment $env, FeatureNode $feature, $skip)
{
$event = new BeforeBackgroundTested($env, $feature, $feature->getBackground());
- $this->eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseTester->setUp($env, $feature, $skip);
$event = new AfterBackgroundSetup($env, $feature, $feature->getBackground(), $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -79,12 +89,23 @@ public function test(Environment $env, FeatureNode $feature, $skip)
public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result)
{
$event = new BeforeBackgroundTeardown($env, $feature, $feature->getBackground(), $result);
- $this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch(BackgroundTested::BEFORE_TEARDOWN, $event);
+
+ }
$teardown = $this->baseTester->tearDown($env, $feature, $skip, $result);
$event = new AfterBackgroundTested($env, $feature, $feature->getBackground(), $result, $teardown);
- $this->eventDispatcher->dispatch($event, BackgroundTested::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, BackgroundTested::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch(BackgroundTested::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
index 088a4d6d1..7175c7620 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
@@ -53,12 +53,22 @@ public function __construct(SpecificationTester $baseTester, EventDispatcherInte
public function setUp(Environment $env, $feature, $skip)
{
$event = new BeforeFeatureTested($env, $feature);
- $this->eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseTester->setUp($env, $feature, $skip);
$event = new AfterFeatureSetup($env, $feature, $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -77,12 +87,22 @@ public function test(Environment $env, $feature, $skip)
public function tearDown(Environment $env, $feature, $skip, TestResult $result)
{
$event = new BeforeFeatureTeardown($env, $feature, $result);
- $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ }
$teardown = $this->baseTester->tearDown($env, $feature, $skip, $result);
$event = new AfterFeatureTested($env, $feature, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $event::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
index 24b3f9898..21850c86f 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
@@ -55,12 +55,22 @@ public function __construct(OutlineTester $baseTester, EventDispatcherInterface
public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip)
{
$event = new BeforeOutlineTested($env, $feature, $outline);
- $this->eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseTester->setUp($env, $feature, $outline, $skip);
$event = new AfterOutlineSetup($env, $feature, $outline, $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -79,12 +89,22 @@ public function test(Environment $env, FeatureNode $feature, OutlineNode $outlin
public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result)
{
$event = new BeforeOutlineTeardown($env, $feature, $outline, $result);
- $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch( $event,$event::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ }
$teardown = $this->baseTester->tearDown($env, $feature, $outline, $skip, $result);
$event = new AfterOutlineTested($env, $feature, $outline, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $event::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
index 85c182e6e..c25c55201 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
@@ -85,12 +85,22 @@ public function __construct(
public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip)
{
$event = new BeforeScenarioTested($env, $feature, $scenario);
- $this->eventDispatcher->dispatch($event, $this->beforeEventName);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $this->beforeEventName);
+ } else {
+ $this->eventDispatcher->dispatch($this->beforeEventName, $event);
+ }
$setup = $this->baseTester->setUp($env, $feature, $scenario, $skip);
$event = new AfterScenarioSetup($env, $feature, $scenario, $setup);
- $this->eventDispatcher->dispatch($event, $this->afterSetupEventName);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $this->afterSetupEventName);
+ } else {
+ $this->eventDispatcher->dispatch($this->afterSetupEventName, $event);
+ }
return $setup;
}
@@ -109,12 +119,22 @@ public function test(Environment $env, FeatureNode $feature, Scenario $scenario,
public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result)
{
$event = new BeforeScenarioTeardown($env, $feature, $scenario, $result);
- $this->eventDispatcher->dispatch($event, $this->beforeTeardownEventName);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $this->beforeTeardownEventName);
+ } else {
+ $this->eventDispatcher->dispatch($this->beforeTeardownEventName, $event);
+ }
$teardown = $this->baseTester->tearDown($env, $feature, $scenario, $skip, $result);
$event = new AfterScenarioTested($env, $feature, $scenario, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $this->afterEventName);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $this->afterEventName);
+ } else {
+ $this->eventDispatcher->dispatch($this->afterEventName, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
index 03337556d..5a0fec6e0 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
@@ -55,12 +55,22 @@ public function __construct(StepTester $baseTester, EventDispatcherInterface $ev
public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip)
{
$event = new BeforeStepTested($env, $feature, $step);
- $this->eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseTester->setUp($env, $feature, $step, $skip);
$event = new AfterStepSetup($env, $feature, $step, $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -79,12 +89,22 @@ public function test(Environment $env, FeatureNode $feature, StepNode $step, $sk
public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result)
{
$event = new BeforeStepTeardown($env, $feature, $step, $result);
- $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ }
$teardown = $this->baseTester->tearDown($env, $feature, $step, $skip, $result);
$event = new AfterStepTested($env, $feature, $step, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $event::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Behat/Gherkin/Cli/SyntaxController.php b/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
index 88397c4b3..62acc12a6 100644
--- a/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
+++ b/src/Behat/Behat/Gherkin/Cli/SyntaxController.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\Gherkin\Cli;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Gherkin\Keywords\KeywordsDumper;
use Behat\Testwork\Cli\Controller;
use Symfony\Component\Console\Command\Command;
@@ -17,7 +18,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Prints example of the feature to present all available syntax keywords.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
index 8cc4a1e7a..9487ecde2 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php
@@ -15,9 +15,9 @@
use Behat\Behat\EventDispatcher\Event\FeatureTested;
use Behat\Behat\Output\Node\Printer\FeaturePrinter;
use Behat\Behat\Output\Node\Printer\SetupPrinter;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to feature events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
index 5881b26c0..85b602b7b 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php
@@ -22,9 +22,9 @@
use Behat\Behat\Output\Node\Printer\SetupPrinter;
use Behat\Behat\Output\Node\Printer\StepPrinter;
use Behat\Gherkin\Node\ExampleNode;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to expanded outline events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
index 7c0607f89..09a179bc1 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php
@@ -24,10 +24,10 @@
use Behat\Behat\Output\Node\Printer\SetupPrinter;
use Behat\Behat\Tester\Result\StepResult;
use Behat\Gherkin\Node\OutlineNode;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Tester\Setup\Setup;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to outline table events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
index 17d455d0d..bcc9f206a 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php
@@ -13,11 +13,11 @@
use Behat\Behat\EventDispatcher\Event\ScenarioLikeTested;
use Behat\Behat\Output\Node\Printer\ScenarioPrinter;
use Behat\Behat\Output\Node\Printer\SetupPrinter;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\AfterSetup;
use Behat\Testwork\EventDispatcher\Event\AfterTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to scenario events and calls appropriate printers (header/footer).
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
index 7392e3448..dda597b72 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php
@@ -18,9 +18,9 @@
use Behat\Behat\Output\Node\Printer\SetupPrinter;
use Behat\Behat\Output\Node\Printer\StepPrinter;
use Behat\Gherkin\Node\ScenarioLikeInterface;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to step events and call appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php b/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
index a679fe852..71ee608fe 100644
--- a/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php
@@ -11,11 +11,11 @@
namespace Behat\Behat\Output\Node\EventListener\AST;
use Behat\Behat\Output\Node\Printer\SetupPrinter;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\AfterSuiteSetup;
use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat suite listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
index fad3c179d..243b200d8 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php
@@ -10,9 +10,9 @@
namespace Behat\Behat\Output\Node\EventListener\Flow;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat fire only siblings listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
index 60200b432..78983627a 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php
@@ -15,9 +15,9 @@
use Behat\Behat\EventDispatcher\Event\FeatureTested;
use Behat\Behat\EventDispatcher\Event\OutlineTested;
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat first background fires first listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
index 1c4c74bfb..9bb73822e 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php
@@ -14,9 +14,9 @@
use Behat\Behat\EventDispatcher\Event\AfterStepTested;
use Behat\Behat\EventDispatcher\Event\BackgroundTested;
use Behat\Behat\EventDispatcher\Event\FeatureTested;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Behat only first background fires listener.
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
index b70789a8c..12604d5b7 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitDurationListener.php
@@ -9,9 +9,9 @@
use Behat\Gherkin\Node\KeywordNodeInterface;
use Behat\Gherkin\Node\ScenarioLikeInterface;
use Behat\Testwork\Counter\Timer;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
final class JUnitDurationListener implements EventListener
{
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
index 479032245..031accdaa 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
@@ -22,10 +22,10 @@
use Behat\Behat\Output\Node\Printer\SetupPrinter;
use Behat\Behat\Output\Node\Printer\StepPrinter;
use Behat\Gherkin\Node\FeatureNode;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\AfterSetup;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens to feature, scenario and step events and calls appropriate printers.
diff --git a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
index e16708684..530a6ca18 100644
--- a/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php
@@ -14,11 +14,11 @@
use Behat\Behat\Output\Node\Printer\SuitePrinter;
use Behat\Gherkin\Node\ExampleNode;
use Behat\Gherkin\Node\OutlineNode;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens for Outline events store the current one
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
index 92040a7ff..a4c9b779b 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php
@@ -13,6 +13,7 @@
use Behat\Behat\Output\Statistics\HookStat;
use Behat\Behat\Output\Statistics\Statistics;
use Behat\Testwork\Call\CallResult;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\AfterSetup;
use Behat\Testwork\EventDispatcher\Event\AfterTested;
use Behat\Testwork\Exception\ExceptionPresenter;
@@ -20,7 +21,6 @@
use Behat\Testwork\Hook\Tester\Setup\HookedTeardown;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records hook stats.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
index c51982e4c..ce94b2b2f 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php
@@ -15,9 +15,9 @@
use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested;
use Behat\Behat\Output\Statistics\ScenarioStat;
use Behat\Behat\Output\Statistics\Statistics;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records scenario events to the statistics.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
index f5a4f0065..763eb76ad 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php
@@ -12,10 +12,10 @@
use Behat\Behat\Output\Node\Printer\StatisticsPrinter;
use Behat\Behat\Output\Statistics\Statistics;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Collects general suite stats such as time and memory during its execution and prints it afterwards.
diff --git a/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
index 2cfcfcf94..2e4a2f7ba 100644
--- a/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
+++ b/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php
@@ -17,16 +17,15 @@
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
use Behat\Behat\Output\Statistics\StepStatV2;
use Behat\Behat\Output\Statistics\Statistics;
-use Behat\Behat\Output\Statistics\StepStat;
use Behat\Behat\Tester\Exception\PendingException;
use Behat\Behat\Tester\Result\ExecutedStepResult;
use Behat\Behat\Tester\Result\StepResult;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Exception\ExceptionPresenter;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Tester\Result\ExceptionResult;
use Exception;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Listens and records step events to statistics.
diff --git a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
index 47655f20e..92954c342 100644
--- a/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php
@@ -10,9 +10,9 @@
namespace Behat\Behat\Output\Node\Printer;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter;
use Behat\Testwork\Output\Printer\OutputPrinter;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat counter printer.
diff --git a/src/Behat/Behat/Output/Node/Printer/ListPrinter.php b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
index 41f92ce97..8f7193649 100644
--- a/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
+++ b/src/Behat/Behat/Output/Node/Printer/ListPrinter.php
@@ -10,6 +10,7 @@
namespace Behat\Behat\Output\Node\Printer;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter;
use Behat\Behat\Output\Statistics\HookStat;
use Behat\Behat\Output\Statistics\ScenarioStat;
@@ -18,7 +19,6 @@
use Behat\Testwork\Exception\ExceptionPresenter;
use Behat\Testwork\Output\Printer\OutputPrinter;
use Behat\Testwork\Tester\Result\TestResult;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat list printer.
diff --git a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
index ec06bc17d..4112b695d 100644
--- a/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
+++ b/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php
@@ -10,11 +10,11 @@
namespace Behat\Behat\Snippet\Printer;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Behat\Snippet\AggregateSnippet;
use Behat\Gherkin\Node\StepNode;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Behat console-based snippet printer.
diff --git a/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php b/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
index 02b889f7b..62b14bd1f 100644
--- a/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
+++ b/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php
@@ -12,6 +12,7 @@
use Behat\Behat\Definition\Call\DefinitionCall;
use Behat\Behat\Definition\Pattern\PatternTransformer;
+use Behat\Behat\Definition\Translator\TranslatorInterface;
use Behat\Behat\Transformation\SimpleArgumentTransformation;
use Behat\Behat\Transformation\Transformation\PatternTransformation;
use Behat\Behat\Transformation\RegexGenerator;
@@ -19,7 +20,6 @@
use Behat\Behat\Transformation\TransformationRepository;
use Behat\Gherkin\Node\ArgumentInterface;
use Behat\Testwork\Call\CallCenter;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Argument transformer based on transformations repository.
diff --git a/src/Behat/Testwork/Event/Event.php b/src/Behat/Testwork/Event/Event.php
new file mode 100644
index 000000000..4e570ef4b
--- /dev/null
+++ b/src/Behat/Testwork/Event/Event.php
@@ -0,0 +1,15 @@
+eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseExercise->setUp($iterators, $skip);
$event = new AfterExerciseSetup($iterators, $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -76,12 +86,22 @@ public function test(array $iterators, $skip = false)
public function tearDown(array $iterators, $skip, TestResult $result)
{
$event = new BeforeExerciseTeardown($iterators, $result);
- $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ }
$teardown = $this->baseExercise->tearDown($iterators, $skip, $result);
$event = new AfterExerciseCompleted($iterators, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $event::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
index 3dbeae502..84a16b8d9 100644
--- a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
+++ b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
@@ -54,12 +54,22 @@ public function __construct(SuiteTester $baseTester, EventDispatcherInterface $e
public function setUp(Environment $env, SpecificationIterator $iterator, $skip)
{
$event = new BeforeSuiteTested($env, $iterator);
- $this->eventDispatcher->dispatch($event, $event::BEFORE);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::BEFORE);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE, $event);
+ }
$setup = $this->baseTester->setUp($env, $iterator, $skip);
$event = new AfterSuiteSetup($env, $iterator, $setup);
- $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
+ }
return $setup;
}
@@ -78,12 +88,21 @@ public function test(Environment $env, SpecificationIterator $iterator, $skip =
public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result)
{
$event = new BeforeSuiteTeardown($env, $iterator, $result);
- $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch( $event, $event::BEFORE_TEARDOWN);
+ } else {
+ $this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
+ }
$teardown = $this->baseTester->tearDown($env, $iterator, $skip, $result);
$event = new AfterSuiteTested($env, $iterator, $result, $teardown);
- $this->eventDispatcher->dispatch($event, $event::AFTER);
+
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch( $event, $event::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch($event::AFTER, $event);
+ }
return $teardown;
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 890b157ed..9555bd314 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -10,7 +10,6 @@
namespace Behat\Testwork\EventDispatcher;
-use Symfony\Contracts\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
@@ -18,42 +17,84 @@
*
* @author Konstantin Kudryashov
*/
-final class TestworkEventDispatcher extends EventDispatcher
-{
- const BEFORE_ALL_EVENTS = '*~';
- const AFTER_ALL_EVENTS = '~*';
-
- /**
- * {@inheritdoc}
- */
- public function dispatch(object $event, string $eventName = null): object
+
+if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+
+ final class TestworkEventDispatcher extends EventDispatcher
{
- if (null === $event) {
- $event = new Event();
- }
+ const BEFORE_ALL_EVENTS = '*~';
+ const AFTER_ALL_EVENTS = '~*';
+
+ /**
+ * {@inheritdoc}
+ */
+ public function dispatch(object $event, string $eventName = null): object
+ {
+ if (null === $event) {
+ $event = new \Symfony\Contracts\EventDispatcher\Event();
+ }
+ if (method_exists($event, 'setName')) {
+ $event->setName($eventName);
+ }
+
+ $this->callListeners($this->getListeners($eventName), $eventName, $event);
- if (method_exists($event, 'setName')) {
- $event->setName($eventName);
+ return $event;
}
- $this->callListeners($this->getListeners($eventName), $eventName, $event);
+ /**
+ * {@inheritdoc}
+ */
+ public function getListeners(string $eventName = null)
+ {
+ if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
+ return parent::getListeners($eventName);
+ }
- return $event;
+ return array_merge(
+ parent::getListeners(self::BEFORE_ALL_EVENTS),
+ parent::getListeners($eventName),
+ parent::getListeners(self::AFTER_ALL_EVENTS)
+ );
+ }
}
+} else {
- /**
- * {@inheritdoc}
- */
- public function getListeners(string $eventName = null)
+ final class TestworkEventDispatcher extends EventDispatcher
{
- if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
- return parent::getListeners($eventName);
+ const BEFORE_ALL_EVENTS = '*~';
+ const AFTER_ALL_EVENTS = '~*';
+
+ /**
+ * {@inheritdoc}
+ */
+ public function dispatch($eventName, \Symfony\Component\EventDispatcher\Event $event = null)
+ {
+ if (null === $event) {
+ $event = new \Symfony\Component\EventDispatcher\Event();
+ }
+ if (method_exists($event, 'setName')) {
+ $event->setName($eventName);
+ }
+ $this->doDispatch($this->getListeners($eventName), $eventName, $event);
+
+ return $event;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getListeners($eventName = null)
+ {
+ if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
+ return parent::getListeners($eventName);
+ }
- return array_merge(
- parent::getListeners(self::BEFORE_ALL_EVENTS),
- parent::getListeners($eventName),
- parent::getListeners(self::AFTER_ALL_EVENTS)
- );
+ return array_merge(
+ parent::getListeners(self::BEFORE_ALL_EVENTS),
+ parent::getListeners($eventName),
+ parent::getListeners(self::AFTER_ALL_EVENTS)
+ );
+ }
}
+
}
diff --git a/src/Behat/Testwork/Exception/ExceptionPresenter.php b/src/Behat/Testwork/Exception/ExceptionPresenter.php
index 9ad0d14c2..3eb4a28bd 100644
--- a/src/Behat/Testwork/Exception/ExceptionPresenter.php
+++ b/src/Behat/Testwork/Exception/ExceptionPresenter.php
@@ -13,7 +13,6 @@
use Behat\Testwork\Exception\Stringer\ExceptionStringer;
use Behat\Testwork\Output\Printer\OutputPrinter;
use Exception;
-use Symfony\Component\Console\Output\OutputInterface;
/**
* Presents exceptions as strings using registered stringers.
diff --git a/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php b/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
index 76695753a..a360581ee 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php
@@ -11,10 +11,10 @@
namespace Behat\Testwork\Output\Node\EventListener;
use ArrayIterator;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Countable;
use IteratorAggregate;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to compose formatter event listeners.
diff --git a/src/Behat/Testwork/Output/Node/EventListener/EventListener.php b/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
index e6145265c..2faaef957 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/EventListener.php
@@ -10,8 +10,8 @@
namespace Behat\Testwork\Output\Node\EventListener;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to define formatter event listeners.
diff --git a/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php b/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
index bbc8d136e..3c917189b 100644
--- a/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
+++ b/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php
@@ -10,9 +10,9 @@
namespace Behat\Testwork\Output\Node\EventListener\Flow;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\Output\Formatter;
use Behat\Testwork\Output\Node\EventListener\EventListener;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Catches all events, but proxies them only if formatter has specific parameter set to a specific value.
diff --git a/src/Behat/Testwork/Output/NodeEventListeningFormatter.php b/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
index 8e5c32a04..272e08041 100644
--- a/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
+++ b/src/Behat/Testwork/Output/NodeEventListeningFormatter.php
@@ -10,10 +10,10 @@
namespace Behat\Testwork\Output;
+use Behat\Testwork\Event\Event;
use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Output\Node\EventListener\EventListener;
use Behat\Testwork\Output\Printer\OutputPrinter;
-use Symfony\Contracts\EventDispatcher\Event;
/**
* Formatter built around the idea of event delegation and composition.
diff --git a/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php b/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php
index 39de237cf..b6e06184e 100644
--- a/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php
+++ b/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php
@@ -91,7 +91,7 @@ public function process(ContainerBuilder $container)
*/
private function loadTranslator(ContainerBuilder $container, $locale, $fallbackLocale)
{
- $definition = new Definition('Symfony\Component\Translation\Translator', array($locale));
+ $definition = new Definition('Behat\Behat\Definition\Translator\Translator', array($locale));
$container->setDefinition(self::TRANSLATOR_ID, $definition);
$definition->addMethodCall('setFallbackLocales', array(array($fallbackLocale)));
From be451e9cab39638718ff0d4ab30117ba9b840a66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 19:23:25 +0100
Subject: [PATCH 177/567] Last treebuilder and code fixes
---
.../Tester/EventDispatchingBackgroundTester.php | 1 -
src/Behat/Testwork/Exception/ExceptionPresenter.php | 1 +
.../ServiceContainer/Configuration/ConfigurationTree.php | 4 ++--
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
index 7b168f448..8593c746f 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
@@ -94,7 +94,6 @@ public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResu
$this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch(BackgroundTested::BEFORE_TEARDOWN, $event);
-
}
$teardown = $this->baseTester->tearDown($env, $feature, $skip, $result);
diff --git a/src/Behat/Testwork/Exception/ExceptionPresenter.php b/src/Behat/Testwork/Exception/ExceptionPresenter.php
index 3eb4a28bd..9ad0d14c2 100644
--- a/src/Behat/Testwork/Exception/ExceptionPresenter.php
+++ b/src/Behat/Testwork/Exception/ExceptionPresenter.php
@@ -13,6 +13,7 @@
use Behat\Testwork\Exception\Stringer\ExceptionStringer;
use Behat\Testwork\Output\Printer\OutputPrinter;
use Exception;
+use Symfony\Component\Console\Output\OutputInterface;
/**
* Presents exceptions as strings using registered stringers.
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
index cf2fa1936..6be1deada 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
@@ -39,13 +39,13 @@ public function getConfigTree(array $extensions)
// BC layer for symfony/config 4.1 and older
$treeBuilder = new TreeBuilder();
/** @var ArrayNodeDefinition $rootNode */
- $rootNode = $treeBuilder->root('sylius_resource');
+ $rootNode = $treeBuilder->root('testwork');
}
foreach ($extensions as $extension) {
$extension->configure($rootNode->children()->arrayNode($extension->getConfigKey()));
}
- return $tree->buildTree();
+ return $treeBuilder->buildTree();
}
}
From 2c1dbf74d49d1d11285282453fef23172652d872 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 20:00:55 +0100
Subject: [PATCH 178/567] Symfony 4.3 is the oldest 4.x maintained version
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 732e4253e..fafcca5b0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,7 +25,7 @@ matrix:
- php: 7.3
env: SYMFONY_VERSION='^3.4'
- php: 7.3
- env: SYMFONY_VERSION='^4.2'
+ env: SYMFONY_VERSION='^4.3'
- php: 7.3
env: SYMFONY_VERSION='^5.0'
From 379c9e1f210a379e64f08ad00c3bfccedc61b524 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 20:01:27 +0100
Subject: [PATCH 179/567] Scrutinizer considers this call to the old library
method something critical
---
.../ServiceContainer/Configuration/ConfigurationTree.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
index 6be1deada..7fe010956 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
@@ -39,6 +39,7 @@ public function getConfigTree(array $extensions)
// BC layer for symfony/config 4.1 and older
$treeBuilder = new TreeBuilder();
/** @var ArrayNodeDefinition $rootNode */
+ /** @scrutinizer ignore-call */
$rootNode = $treeBuilder->root('testwork');
}
From 70eb4035e5e44899ad2e6fc39d5d3eae543acfdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 21:05:48 +0100
Subject: [PATCH 180/567] Added changes to maximize BC compatibility
---
.../Behat/Definition/Translator/TranslatorInterface.php | 2 +-
src/Behat/Testwork/EventDispatcher/Cli/SigintController.php | 6 +++++-
.../Testwork/EventDispatcher/TestworkEventDispatcher.php | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
index 8a89f74fa..c2827fafe 100644
--- a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
+++ b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
@@ -7,7 +7,7 @@ interface TranslatorInterface extends \Symfony\Contracts\Translation\TranslatorI
{
}
} else {
- interface TranslatorInterface extends \Symfony\Component\Translation\TranslatorInterface
+ interface TranslatorInterface extends \Symfony\Component\Translation\TranslatorInterface
{
}
}
diff --git a/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php b/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
index 24a639c9c..9f6a9cef8 100644
--- a/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
+++ b/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
@@ -63,7 +63,11 @@ public function execute(InputInterface $input, OutputInterface $output)
*/
public function abortExercise()
{
- $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());
+ if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
+ } else {
+ $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());
+ }
exit(1);
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 9555bd314..88a5d1ddf 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -28,7 +28,7 @@ final class TestworkEventDispatcher extends EventDispatcher
/**
* {@inheritdoc}
*/
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch($event, string $eventName = null): object
{
if (null === $event) {
$event = new \Symfony\Contracts\EventDispatcher\Event();
From 389a25d9297c692767a2b466daedd505b0323676 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 21:29:35 +0100
Subject: [PATCH 181/567] BC: Remove type reference from the method signature
---
src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 88a5d1ddf..e9c3c1d82 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -45,7 +45,7 @@ public function dispatch($event, string $eventName = null): object
/**
* {@inheritdoc}
*/
- public function getListeners(string $eventName = null)
+ public function getListeners($eventName = null)
{
if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
return parent::getListeners($eventName);
From e04a6ebb7f6d88c45344467d0a7cd44190e32a63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Wed, 27 Nov 2019 21:49:45 +0100
Subject: [PATCH 182/567] Process BC compatibility for symfony 3.4
---
features/bootstrap/FeatureContext.php | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 6b63074f6..4aaf6f795 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -190,16 +190,22 @@ public function iRunBehat($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
- $this->process = Process::fromShellCommandline(
- sprintf(
- '%s %s %s %s',
- $this->phpBin,
- escapeshellarg(BEHAT_BIN_PATH),
- $argumentsString,
- strtr($this->options, array('\'' => '"', '"' => '\"'))
- )
+ $cmd = sprintf(
+ '%s %s %s %s',
+ $this->phpBin,
+ escapeshellarg(BEHAT_BIN_PATH),
+ $argumentsString,
+ strtr($this->options, array('\'' => '"', '"' => '\"'))
);
+ if (method_exists('\\Symfony\\Component\\Process\\Process', 'fromShellCommandline')) {
+ $this->process = Process::fromShellCommandline($cmd);
+ } else {
+ // BC layer for symfony/process 4.1 and older
+ $this->process = new Process(null);
+ $this->process->setCommandLine($cmd);
+ }
+
// Prepare the process parameters.
$this->process->setTimeout(20);
$this->process->setEnv($this->env);
From 8fcc67e69950a8c0eaf16ef968faf6c22fb239fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20D=C3=ADaz?=
Date: Sun, 1 Dec 2019 13:39:23 +0100
Subject: [PATCH 183/567] Some extra work to have scrutinizer green
---
src/Behat/Behat/Definition/Translator/TranslatorInterface.php | 2 +-
src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
index c2827fafe..5384a48d2 100644
--- a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
+++ b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
@@ -6,7 +6,7 @@
interface TranslatorInterface extends \Symfony\Contracts\Translation\TranslatorInterface
{
}
-} else {
+} else if (interface_exists(\Symfony\Component\Translation\TranslatorInterface::class)) {
interface TranslatorInterface extends \Symfony\Component\Translation\TranslatorInterface
{
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index e9c3c1d82..7b7125b7b 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -76,6 +76,7 @@ public function dispatch($eventName, \Symfony\Component\EventDispatcher\Event $e
if (method_exists($event, 'setName')) {
$event->setName($eventName);
}
+ /** @scrutinizer ignore-call */
$this->doDispatch($this->getListeners($eventName), $eventName, $event);
return $event;
From 6dab359f76ca0bcb2f0c86b0aa96efe136954562 Mon Sep 17 00:00:00 2001
From: Nyholm
Date: Sat, 7 Dec 2019 15:30:37 +0100
Subject: [PATCH 184/567] Fixed build
---
composer.json | 16 +++++------
.../Translator/TranslatorInterface.php | 2 +-
.../Cli/StopOnFailureController.php | 3 ++-
.../EventDispatchingBackgroundTester.php | 9 ++++---
.../Tester/EventDispatchingFeatureTester.php | 9 ++++---
.../Tester/EventDispatchingOutlineTester.php | 9 ++++---
.../Tester/EventDispatchingScenarioTester.php | 9 ++++---
.../Tester/EventDispatchingStepTester.php | 9 ++++---
src/Behat/Testwork/Event/Event.php | 3 ++-
.../EventDispatcher/Cli/SigintController.php | 3 ++-
.../Tester/EventDispatchingExercise.php | 9 ++++---
.../Tester/EventDispatchingSuiteTester.php | 9 ++++---
.../TestworkEventDispatcher.php | 24 +++++------------
.../TestworkEventDispatcherPhp72Trait.php | 27 +++++++++++++++++++
14 files changed, 83 insertions(+), 58 deletions(-)
create mode 100644 src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
diff --git a/composer.json b/composer.json
index 2abbfd968..7390a5018 100644
--- a/composer.json
+++ b/composer.json
@@ -18,19 +18,19 @@
"ext-mbstring": "*",
"behat/gherkin": "^4.6.0",
"behat/transliterator": "^1.2",
- "symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3||^5.0.0",
- "symfony/config": "~2.3||~3.0||~4.0||~5.0",
- "symfony/dependency-injection": "~2.1||~3.0||~4.0||~5.0",
- "symfony/event-dispatcher": "~2.1||~3.0||~4.0||~5.0",
- "symfony/translation": "~2.3||~3.0||~4.0||~5.0",
- "symfony/yaml": "~2.1||~3.0||~4.0||~5.0",
+ "symfony/console": "^2.7.51 || ^2.8.33 || ^3.3.15 || ^3.4.3 || ^4.0.3 || ^5.0",
+ "symfony/config": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
+ "symfony/dependency-injection": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
+ "symfony/event-dispatcher": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
+ "symfony/translation": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
+ "symfony/yaml": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
"psr/container": "^1.0",
"container-interop/container-interop": "^1.2"
},
"require-dev": {
- "symfony/process": "~2.5|~3.0|~4.0|~5.0",
- "phpunit/phpunit": "^4.8.36|^6.3",
+ "symfony/process": "~2.5 || ^3.0 || ^4.0 || ^5.0",
+ "phpunit/phpunit": "^4.8.36 || ^6.3",
"herrera-io/box": "~1.6.1"
},
diff --git a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
index 5384a48d2..9ad91e381 100644
--- a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
+++ b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
@@ -6,7 +6,7 @@
interface TranslatorInterface extends \Symfony\Contracts\Translation\TranslatorInterface
{
}
-} else if (interface_exists(\Symfony\Component\Translation\TranslatorInterface::class)) {
+} elseif (interface_exists(\Symfony\Component\Translation\TranslatorInterface::class)) {
interface TranslatorInterface extends \Symfony\Component\Translation\TranslatorInterface
{
}
diff --git a/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php b/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
index f5d7f627a..637f99dd0 100644
--- a/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
+++ b/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php
@@ -18,6 +18,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterSuiteAborted;
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
use Behat\Testwork\EventDispatcher\Event\SuiteTested;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Result\Interpretation\ResultInterpretation;
use Behat\Testwork\Tester\Result\Interpretation\SoftInterpretation;
use Behat\Testwork\Tester\Result\Interpretation\StrictInterpretation;
@@ -100,7 +101,7 @@ public function exitOnFailure(AfterScenarioTested $event)
return;
}
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch(new AfterSuiteAborted($event->getEnvironment()), SuiteTested::AFTER);
$this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
} else {
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
index 8593c746f..2c50db1f5 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php
@@ -18,6 +18,7 @@
use Behat\Behat\Tester\BackgroundTester;
use Behat\Gherkin\Node\FeatureNode;
use Behat\Testwork\Environment\Environment;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Result\TestResult;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -56,7 +57,7 @@ public function setUp(Environment $env, FeatureNode $feature, $skip)
{
$event = new BeforeBackgroundTested($env, $feature, $feature->getBackground());
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -66,7 +67,7 @@ public function setUp(Environment $env, FeatureNode $feature, $skip)
$event = new AfterBackgroundSetup($env, $feature, $feature->getBackground(), $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -90,7 +91,7 @@ public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResu
{
$event = new BeforeBackgroundTeardown($env, $feature, $feature->getBackground(), $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch(BackgroundTested::BEFORE_TEARDOWN, $event);
@@ -100,7 +101,7 @@ public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResu
$event = new AfterBackgroundTested($env, $feature, $feature->getBackground(), $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, BackgroundTested::AFTER);
} else {
$this->eventDispatcher->dispatch(BackgroundTested::AFTER, $event);
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
index 7175c7620..c07313b61 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php
@@ -15,6 +15,7 @@
use Behat\Behat\EventDispatcher\Event\BeforeFeatureTeardown;
use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested;
use Behat\Testwork\Environment\Environment;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\Testwork\Tester\SpecificationTester;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -54,7 +55,7 @@ public function setUp(Environment $env, $feature, $skip)
{
$event = new BeforeFeatureTested($env, $feature);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -64,7 +65,7 @@ public function setUp(Environment $env, $feature, $skip)
$event = new AfterFeatureSetup($env, $feature, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -88,7 +89,7 @@ public function tearDown(Environment $env, $feature, $skip, TestResult $result)
{
$event = new BeforeFeatureTeardown($env, $feature, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
@@ -98,7 +99,7 @@ public function tearDown(Environment $env, $feature, $skip, TestResult $result)
$event = new AfterFeatureTested($env, $feature, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER);
} else {
$this->eventDispatcher->dispatch($event::AFTER, $event);
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
index 21850c86f..3b1d77fa9 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php
@@ -18,6 +18,7 @@
use Behat\Gherkin\Node\FeatureNode;
use Behat\Gherkin\Node\OutlineNode;
use Behat\Testwork\Environment\Environment;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Result\TestResult;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -56,7 +57,7 @@ public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outli
{
$event = new BeforeOutlineTested($env, $feature, $outline);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -66,7 +67,7 @@ public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outli
$event = new AfterOutlineSetup($env, $feature, $outline, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -90,7 +91,7 @@ public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $ou
{
$event = new BeforeOutlineTeardown($env, $feature, $outline, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch( $event,$event::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
@@ -100,7 +101,7 @@ public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $ou
$event = new AfterOutlineTested($env, $feature, $outline, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER);
} else {
$this->eventDispatcher->dispatch($event::AFTER, $event);
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
index c25c55201..a45ee5ac9 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php
@@ -18,6 +18,7 @@
use Behat\Gherkin\Node\FeatureNode;
use Behat\Gherkin\Node\ScenarioInterface as Scenario;
use Behat\Testwork\Environment\Environment;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Result\TestResult;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -86,7 +87,7 @@ public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario
{
$event = new BeforeScenarioTested($env, $feature, $scenario);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $this->beforeEventName);
} else {
$this->eventDispatcher->dispatch($this->beforeEventName, $event);
@@ -96,7 +97,7 @@ public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario
$event = new AfterScenarioSetup($env, $feature, $scenario, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $this->afterSetupEventName);
} else {
$this->eventDispatcher->dispatch($this->afterSetupEventName, $event);
@@ -120,7 +121,7 @@ public function tearDown(Environment $env, FeatureNode $feature, Scenario $scena
{
$event = new BeforeScenarioTeardown($env, $feature, $scenario, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $this->beforeTeardownEventName);
} else {
$this->eventDispatcher->dispatch($this->beforeTeardownEventName, $event);
@@ -130,7 +131,7 @@ public function tearDown(Environment $env, FeatureNode $feature, Scenario $scena
$event = new AfterScenarioTested($env, $feature, $scenario, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $this->afterEventName);
} else {
$this->eventDispatcher->dispatch($this->afterEventName, $event);
diff --git a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
index 5a0fec6e0..3fa53f8df 100644
--- a/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
+++ b/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php
@@ -19,6 +19,7 @@
use Behat\Gherkin\Node\FeatureNode;
use Behat\Gherkin\Node\StepNode;
use Behat\Testwork\Environment\Environment;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
@@ -56,7 +57,7 @@ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $s
{
$event = new BeforeStepTested($env, $feature, $step);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -66,7 +67,7 @@ public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $s
$event = new AfterStepSetup($env, $feature, $step, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -90,7 +91,7 @@ public function tearDown(Environment $env, FeatureNode $feature, StepNode $step,
{
$event = new BeforeStepTeardown($env, $feature, $step, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
@@ -100,7 +101,7 @@ public function tearDown(Environment $env, FeatureNode $feature, StepNode $step,
$event = new AfterStepTested($env, $feature, $step, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER);
} else {
$this->eventDispatcher->dispatch($event::AFTER, $event);
diff --git a/src/Behat/Testwork/Event/Event.php b/src/Behat/Testwork/Event/Event.php
index 4e570ef4b..859a9d0f1 100644
--- a/src/Behat/Testwork/Event/Event.php
+++ b/src/Behat/Testwork/Event/Event.php
@@ -2,8 +2,9 @@
namespace Behat\Testwork\Event;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
-if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
class Event extends \Symfony\Contracts\EventDispatcher\Event
{
}
diff --git a/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php b/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
index 9f6a9cef8..cf9338b25 100644
--- a/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
+++ b/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
@@ -13,6 +13,7 @@
use Behat\Testwork\Cli\Controller;
use Behat\Testwork\EventDispatcher\Event\AfterExerciseAborted;
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -63,7 +64,7 @@ public function execute(InputInterface $input, OutputInterface $output)
*/
public function abortExercise()
{
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER);
} else {
$this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());
diff --git a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
index 6f48f6232..0ea275d6c 100644
--- a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
+++ b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php
@@ -14,6 +14,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterExerciseSetup;
use Behat\Testwork\EventDispatcher\Event\BeforeExerciseCompleted;
use Behat\Testwork\EventDispatcher\Event\BeforeExerciseTeardown;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Tester\Exercise;
use Behat\Testwork\Tester\Result\TestResult;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -53,7 +54,7 @@ public function setUp(array $iterators, $skip)
{
$event = new BeforeExerciseCompleted($iterators);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -63,7 +64,7 @@ public function setUp(array $iterators, $skip)
$event = new AfterExerciseSetup($iterators, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -87,7 +88,7 @@ public function tearDown(array $iterators, $skip, TestResult $result)
{
$event = new BeforeExerciseTeardown($iterators, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
@@ -97,7 +98,7 @@ public function tearDown(array $iterators, $skip, TestResult $result)
$event = new AfterExerciseCompleted($iterators, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER);
} else {
$this->eventDispatcher->dispatch($event::AFTER, $event);
diff --git a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
index 84a16b8d9..466a759f1 100644
--- a/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
+++ b/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php
@@ -15,6 +15,7 @@
use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTeardown;
use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested;
+use Behat\Testwork\EventDispatcher\TestworkEventDispatcher;
use Behat\Testwork\Specification\SpecificationIterator;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\Testwork\Tester\SuiteTester;
@@ -55,7 +56,7 @@ public function setUp(Environment $env, SpecificationIterator $iterator, $skip)
{
$event = new BeforeSuiteTested($env, $iterator);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::BEFORE);
} else {
$this->eventDispatcher->dispatch($event::BEFORE, $event);
@@ -65,7 +66,7 @@ public function setUp(Environment $env, SpecificationIterator $iterator, $skip)
$event = new AfterSuiteSetup($env, $iterator, $setup);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch($event, $event::AFTER_SETUP);
} else {
$this->eventDispatcher->dispatch($event::AFTER_SETUP, $event);
@@ -88,7 +89,7 @@ public function test(Environment $env, SpecificationIterator $iterator, $skip =
public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result)
{
$event = new BeforeSuiteTeardown($env, $iterator, $result);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch( $event, $event::BEFORE_TEARDOWN);
} else {
$this->eventDispatcher->dispatch($event::BEFORE_TEARDOWN, $event);
@@ -98,7 +99,7 @@ public function tearDown(Environment $env, SpecificationIterator $iterator, $ski
$event = new AfterSuiteTested($env, $iterator, $result, $teardown);
- if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+ if (TestworkEventDispatcher::DISPATCHER_VERSION === 2) {
$this->eventDispatcher->dispatch( $event, $event::AFTER);
} else {
$this->eventDispatcher->dispatch($event::AFTER, $event);
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 7b7125b7b..66afc961a 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -18,29 +18,16 @@
* @author Konstantin Kudryashov
*/
-if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
+if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class) && PHP_VERSION_ID > 70200) {
+ // Assert: This is Symfony 5 and PHP >= 7.2
+ include_once __DIR__.'/TestworkEventDispatcherPhp72Trait.php';
final class TestworkEventDispatcher extends EventDispatcher
{
+ use \TestworkEventDispatcherPhp72Trait;
const BEFORE_ALL_EVENTS = '*~';
const AFTER_ALL_EVENTS = '~*';
-
- /**
- * {@inheritdoc}
- */
- public function dispatch($event, string $eventName = null): object
- {
- if (null === $event) {
- $event = new \Symfony\Contracts\EventDispatcher\Event();
- }
- if (method_exists($event, 'setName')) {
- $event->setName($eventName);
- }
-
- $this->callListeners($this->getListeners($eventName), $eventName, $event);
-
- return $event;
- }
+ const DISPATCHER_VERSION = 2;
/**
* {@inheritdoc}
@@ -64,6 +51,7 @@ final class TestworkEventDispatcher extends EventDispatcher
{
const BEFORE_ALL_EVENTS = '*~';
const AFTER_ALL_EVENTS = '~*';
+ const DISPATCHER_VERSION = 1;
/**
* {@inheritdoc}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
new file mode 100644
index 000000000..1387bec4f
--- /dev/null
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
@@ -0,0 +1,27 @@
+
+ */
+trait TestworkEventDispatcherPhp72Trait
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function dispatch($event, string $eventName = null): object
+ {
+ if (null === $event) {
+ $event = new \Symfony\Contracts\EventDispatcher\Event();
+ }
+ if (method_exists($event, 'setName')) {
+ $event->setName($eventName);
+ }
+
+ $this->callListeners($this->getListeners($eventName), $eventName, $event);
+
+ return $event;
+ }
+}
\ No newline at end of file
From b4f7a00d5ca5650cee641d305eb4f24399b5d23d Mon Sep 17 00:00:00 2001
From: Sam Burns
Date: Thu, 16 Jan 2020 10:16:29 +0000
Subject: [PATCH 185/567] Fix Appveyor build
---
appveyor.yml | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index 58e8a4eba..5095fe212 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,10 +4,6 @@ shallow_clone: false
platform: x86
clone_folder: c:\projects\behat
-environment:
- matrix:
- - php: 7.2
-
branches:
only:
- master
@@ -31,7 +27,7 @@ init:
install:
- ps: |
if (!(Test-Path c:\tools\php)) {
- appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
+ appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version 7.2
Get-ChildItem -Path c:\tools\php
cd c:\tools\php
From e60892311d20888bc6dd1556f72e9bb1f49e6dde Mon Sep 17 00:00:00 2001
From: Lctrs
Date: Thu, 16 Jan 2020 17:23:24 +0100
Subject: [PATCH 186/567] ExtensionManager#getExtension() can also return null
---
src/Behat/Testwork/ServiceContainer/ExtensionManager.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Testwork/ServiceContainer/ExtensionManager.php b/src/Behat/Testwork/ServiceContainer/ExtensionManager.php
index 7e2d955dc..45e040442 100644
--- a/src/Behat/Testwork/ServiceContainer/ExtensionManager.php
+++ b/src/Behat/Testwork/ServiceContainer/ExtensionManager.php
@@ -81,7 +81,7 @@ public function activateExtension($locator)
*
* @param string $key
*
- * @return Extension
+ * @return Extension|null
*/
public function getExtension($key)
{
From f947c16dbc2bc63cbcce51b90912da6a5c9ea95e Mon Sep 17 00:00:00 2001
From: Daniel Marynicz
Date: Fri, 31 Jan 2020 11:37:43 +0100
Subject: [PATCH 187/567] fix php 7.1 deprecation for
ReflectionType::__toString
---
.../Transformation/ReturnTypeTransformation.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
index ecdc613a1..bf5d2eb40 100644
--- a/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
+++ b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
@@ -130,6 +130,10 @@ static private function getReturnClass(ReflectionFunctionAbstract $reflection)
return null;
}
+ if (PHP_VERSION_ID >= 70100) {
+ return $type->getName();
+ }
+
return (string) $type;
}
From 557a1ffedff0a7fe1b0990121efe5e26ee98d1ae Mon Sep 17 00:00:00 2001
From: Daniel Marynicz
Date: Fri, 31 Jan 2020 14:39:36 +0100
Subject: [PATCH 188/567] fix php 7.1 deprecation for
ReflectionType::__toString
---
.../Transformation/Transformation/ReturnTypeTransformation.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
index bf5d2eb40..7f43e2398 100644
--- a/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
+++ b/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php
@@ -19,6 +19,7 @@
use ReflectionFunctionAbstract;
use ReflectionMethod;
use ReflectionParameter;
+use ReflectionNamedType;
/**
* By-type object transformation.
@@ -130,7 +131,7 @@ static private function getReturnClass(ReflectionFunctionAbstract $reflection)
return null;
}
- if (PHP_VERSION_ID >= 70100) {
+ if ($type instanceof ReflectionNamedType) {
return $type->getName();
}
From e652e8bde3a69170ce2337ad1b47de1d5092164f Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Tue, 4 Feb 2020 16:23:41 +0000
Subject: [PATCH 189/567] Update CHANGELOG.md
---
CHANGELOG.md | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8bbc0645c..955d00946 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
-## [Unreleased]
+## [3.6.0] - 2019-02-04
* [#1256](https://github.com/Behat/Behat/pull/1256): Update dependencies to support Symfony 5.x
### Added
* [#1244](https://github.com/Behat/Behat/pull/1244): Hide internal steps from stack traces in very verbose mode
+### Fixed
+ * [#1238](https://github.com/Behat/Behat/pull/1238): Don't run Junit output if ext-dom is not present (and suggest in composer)
+### Changed
+ * [#1171](https://github.com/Behat/Behat/pull/1171): Remove symfony/class-loader dependency
+ * [#1170](https://github.com/Behat/Behat/pull/1170): Switch to PSR-4 autoloading
+ * [#1230](https://github.com/Behat/Behat/pull/1230): PHP 7.3 support
+ * [#1230](https://github.com/Behat/Behat/pull/1230): Suggest ext-dom for JUnit support
## [3.5.0] - 2018-08-10
### Added
From ed416583883e2565a00973f61b58c25b98e75a19 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Tue, 4 Feb 2020 16:24:29 +0000
Subject: [PATCH 190/567] Update composer.json
---
composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index 7390a5018..3dec2c213 100644
--- a/composer.json
+++ b/composer.json
@@ -53,7 +53,7 @@
"extra": {
"branch-alias": {
- "dev-master": "3.5.x-dev"
+ "dev-master": "3.6.x-dev"
}
},
From de002f40188e74fcd442c5a6480cee76a9cfc84a Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Tue, 4 Feb 2020 16:26:31 +0000
Subject: [PATCH 191/567] Update version number for 3.6.0
---
src/Behat/Behat/ApplicationFactory.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index d9838a1fb..316ebff0d 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -46,7 +46,7 @@
*/
final class ApplicationFactory extends BaseFactory
{
- const VERSION = '3.5.0';
+ const VERSION = '3.6.0';
/**
* {@inheritdoc}
From ea5923ec6fd830d6ae22c17b469dd3390362a49b Mon Sep 17 00:00:00 2001
From: acoulton
Date: Wed, 5 Feb 2020 11:51:09 +0000
Subject: [PATCH 192/567] Fix fatal due to wrong symfony/event-dispatcher
version detection
The version detection added in #1256 to support symfony 5 relies
only on checking for the presence of a class provided by the
(separate) symfony/event-dispatcher-contracts package.
However, symfony/console 4.2 also requires symfony/contracts
but can coexist with older versions of symfony/event-dispatcher.
Therefore for example if a project has a constraint on updating
symfony/event-dispatcher (e.g. because of using Guzzle 3,
which requires event-dispatcher ~2.1) composer will install:
* symfony/console @ 4.2.12 (latest that doesn't advertise a
conflict with newer event-dispatcher)
* symfony/contracts @ 1.1.8 (latest that satisfies the console
requirement)
* symfony/event-dispatcher @ 2.8.52 (latest that satisfies
guzzle)
In this setup the presence of symfony/contracts incorrectly
signals to behat that we are running symfony 5 and causes a
fatal error when it loads the new implementation of
TestworkEventDispatcher.
The only change between the two versions is that the method
signature for dispatch has changed order and types.
Instead of looking at packages, it is more robust just to use
reflection to detect which version of the dispatch() method
is defined, and then load the extension class that matches
that signature.
Fixes #1277
---
.../TestworkEventDispatcher.php | 92 +++++++------------
.../TestworkEventDispatcherPhp72Trait.php | 27 ------
.../TestworkEventDispatcherSymfony5.php | 55 +++++++++++
.../TestworkEventDispatcherSymfonyLegacy.php | 56 +++++++++++
4 files changed, 145 insertions(+), 85 deletions(-)
delete mode 100644 src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
create mode 100644 src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfony5.php
create mode 100644 src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfonyLegacy.php
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 66afc961a..0523301d3 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -17,73 +17,49 @@
*
* @author Konstantin Kudryashov
*/
+$identifyEventDispatcherClassVersion = function() {
+ $reflection = new \ReflectionClass(\Symfony\Component\EventDispatcher\EventDispatcher::class);
+ $dispatch = $reflection->getMethod('dispatch');
-if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class) && PHP_VERSION_ID > 70200) {
- // Assert: This is Symfony 5 and PHP >= 7.2
- include_once __DIR__.'/TestworkEventDispatcherPhp72Trait.php';
+ if ($dispatch->getNumberOfParameters() === 1) {
+ // This is the 4.3 / 4.4 version, which has `public function dispatch($event/*, string $eventName = null*/)` and
+ // internally uses func_get_args to work parameters it got in what order. The legacy Testwork class can still
+ // extend this because its signature only adds an extra optional param. It may however produce unexpected
+ // results as it assumes all dispatch calls are with the legacy sequence of $eventName, $event.
+ return TestworkEventDispatcherSymfonyLegacy::class;
+ }
- final class TestworkEventDispatcher extends EventDispatcher
- {
- use \TestworkEventDispatcherPhp72Trait;
- const BEFORE_ALL_EVENTS = '*~';
- const AFTER_ALL_EVENTS = '~*';
- const DISPATCHER_VERSION = 2;
+ $first_param = $dispatch->getParameters()[0];
+ switch ($first_param->getName()) {
+ case 'event':
+ // This is the new Symfony 5 event dispatcher interface
+ // public function dispatch(object $event, string $eventName = null): object
+ return TestworkEventDispatcherSymfony5::class;
- /**
- * {@inheritdoc}
- */
- public function getListeners($eventName = null)
- {
- if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
- return parent::getListeners($eventName);
- }
+ case 'eventName':
+ // This is the Symfony <= 4.2 version
+ // public function dispatch($eventName, Event $event = null)
+ return TestworkEventDispatcherSymfonyLegacy::class;
- return array_merge(
- parent::getListeners(self::BEFORE_ALL_EVENTS),
- parent::getListeners($eventName),
- parent::getListeners(self::AFTER_ALL_EVENTS)
- );
- }
+ default:
+ throw new \UnexpectedValueException('Could not identify which version of symfony/event-dispatcher is in use, could not define a compatible TestworkEventDispatcher');
}
-} else {
+};
+
+class_alias($identifyEventDispatcherClassVersion(), \Behat\Testwork\EventDispatcher\TestworkEventDispatcher::class);
+unset($identifyEventDispatcherClassVersion);
- final class TestworkEventDispatcher extends EventDispatcher
- {
- const BEFORE_ALL_EVENTS = '*~';
- const AFTER_ALL_EVENTS = '~*';
- const DISPATCHER_VERSION = 1;
- /**
- * {@inheritdoc}
- */
- public function dispatch($eventName, \Symfony\Component\EventDispatcher\Event $event = null)
- {
- if (null === $event) {
- $event = new \Symfony\Component\EventDispatcher\Event();
- }
- if (method_exists($event, 'setName')) {
- $event->setName($eventName);
- }
- /** @scrutinizer ignore-call */
- $this->doDispatch($this->getListeners($eventName), $eventName, $event);
+if (false) {
- return $event;
- }
- /**
- * {@inheritdoc}
- */
- public function getListeners($eventName = null)
- {
- if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
- return parent::getListeners($eventName);
- }
+ // Empty, never-actually-defined, class definition to fool any tooling looking for a class in this file
+ final class TestworkEventDispatcher
+ {
- return array_merge(
- parent::getListeners(self::BEFORE_ALL_EVENTS),
- parent::getListeners($eventName),
- parent::getListeners(self::AFTER_ALL_EVENTS)
- );
- }
+ // These constant definitions are required to prevent scrutinizer failing static analysis
+ const BEFORE_ALL_EVENTS = '*~';
+ const AFTER_ALL_EVENTS = '~*';
+ const DISPATCHER_VERSION = 'undefined';
}
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
deleted file mode 100644
index 1387bec4f..000000000
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherPhp72Trait.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- */
-trait TestworkEventDispatcherPhp72Trait
-{
- /**
- * {@inheritdoc}
- */
- public function dispatch($event, string $eventName = null): object
- {
- if (null === $event) {
- $event = new \Symfony\Contracts\EventDispatcher\Event();
- }
- if (method_exists($event, 'setName')) {
- $event->setName($eventName);
- }
-
- $this->callListeners($this->getListeners($eventName), $eventName, $event);
-
- return $event;
- }
-}
\ No newline at end of file
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfony5.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfony5.php
new file mode 100644
index 000000000..42da5ce54
--- /dev/null
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfony5.php
@@ -0,0 +1,55 @@
+=5.0) event dispatcher with catch-all listeners.
+ *
+ * This is magically aliased to TestworkEventDispatcher by the code in TestworkEventDispatcher.php
+ * if the new symfony interface is detected.
+ *
+ * @deprecated Do not reference this class directly, use TestworkEventDispatcher
+ */
+final class TestworkEventDispatcherSymfony5 extends EventDispatcher
+{
+ const BEFORE_ALL_EVENTS = '*~';
+ const AFTER_ALL_EVENTS = '~*';
+ const DISPATCHER_VERSION = 2;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function dispatch($event, string $eventName = null): object
+ {
+ if (null === $event) {
+ $event = new \Symfony\Contracts\EventDispatcher\Event();
+ }
+ if (method_exists($event, 'setName')) {
+ $event->setName($eventName);
+ }
+
+ $this->callListeners($this->getListeners($eventName), $eventName, $event);
+
+ return $event;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListeners($eventName = null)
+ {
+ if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
+ return parent::getListeners($eventName);
+ }
+
+ return array_merge(
+ parent::getListeners(self::BEFORE_ALL_EVENTS),
+ parent::getListeners($eventName),
+ parent::getListeners(self::AFTER_ALL_EVENTS)
+ );
+ }
+}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfonyLegacy.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfonyLegacy.php
new file mode 100644
index 000000000..475fc4d00
--- /dev/null
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcherSymfonyLegacy.php
@@ -0,0 +1,56 @@
+setName($eventName);
+ }
+ /** @scrutinizer ignore-call */
+ $this->doDispatch($this->getListeners($eventName), $eventName, $event);
+
+ return $event;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListeners($eventName = null)
+ {
+ if (null == $eventName || self::BEFORE_ALL_EVENTS === $eventName) {
+ return parent::getListeners($eventName);
+ }
+
+ return array_merge(
+ parent::getListeners(self::BEFORE_ALL_EVENTS),
+ parent::getListeners($eventName),
+ parent::getListeners(self::AFTER_ALL_EVENTS)
+ );
+ }
+}
From b45d6842daeeeb8311badf76ebe0f0dcdde2a9f8 Mon Sep 17 00:00:00 2001
From: Ciaran McNulty
Date: Thu, 6 Feb 2020 09:55:35 +0100
Subject: [PATCH 193/567] Update for 3.6.1 release
---
CHANGELOG.md | 6 +++++-
src/Behat/Behat/ApplicationFactory.php | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 955d00946..6b2b26442 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,13 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [3.6.1] - 2019-02-06
+### Fixed
+ * [#1278](https://github.com/Behat/Behat/pull/1278): Fix fatal when unexpected symfony/event-dispatcher version is installed
+
## [3.6.0] - 2019-02-04
- * [#1256](https://github.com/Behat/Behat/pull/1256): Update dependencies to support Symfony 5.x
### Added
* [#1244](https://github.com/Behat/Behat/pull/1244): Hide internal steps from stack traces in very verbose mode
### Fixed
* [#1238](https://github.com/Behat/Behat/pull/1238): Don't run Junit output if ext-dom is not present (and suggest in composer)
### Changed
+ * [#1256](https://github.com/Behat/Behat/pull/1256): Update dependencies to support Symfony 5.x
* [#1171](https://github.com/Behat/Behat/pull/1171): Remove symfony/class-loader dependency
* [#1170](https://github.com/Behat/Behat/pull/1170): Switch to PSR-4 autoloading
* [#1230](https://github.com/Behat/Behat/pull/1230): PHP 7.3 support
diff --git a/src/Behat/Behat/ApplicationFactory.php b/src/Behat/Behat/ApplicationFactory.php
index 316ebff0d..8fba06a7e 100644
--- a/src/Behat/Behat/ApplicationFactory.php
+++ b/src/Behat/Behat/ApplicationFactory.php
@@ -46,7 +46,7 @@
*/
final class ApplicationFactory extends BaseFactory
{
- const VERSION = '3.6.0';
+ const VERSION = '3.6.1';
/**
* {@inheritdoc}
From d133f0040f9d255a098cab4775381b5893b8cd4d Mon Sep 17 00:00:00 2001
From: Sam Burns
Date: Wed, 15 Jan 2020 23:19:13 +0000
Subject: [PATCH 194/567] Fix bug with build command introduced in
0353b4b85ca9182643c18648980fccccb761e9fa. Exposes issue with PHP5.4 tests
running in PHP7.4, etc.
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index fafcca5b0..c58fe9793 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,7 +37,7 @@ before_script:
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
- export PATH=./bin:$PATH
- - echo " php_version_tags.php
+ - echo " php_version_tags.php
script:
- ./vendor/bin/phpunit
From 13b91d8e0bb34622bb5e2b40785a5027d2d9b7a8 Mon Sep 17 00:00:00 2001
From: Sam Burns
Date: Wed, 15 Jan 2020 23:30:45 +0000
Subject: [PATCH 195/567] Make tests use correct PHP major version
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index c58fe9793..8804bb3c7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,7 +37,7 @@ before_script:
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
- export PATH=./bin:$PATH
- - echo " php_version_tags.php
+ - echo " php_version_tags.php
script:
- ./vendor/bin/phpunit
From 3aeb45e3497b17cc28c7adb56c814a8e931c7e5f Mon Sep 17 00:00:00 2001
From: Sam Burns
Date: Wed, 15 Jan 2020 23:41:36 +0000
Subject: [PATCH 196/567] Simplify build commands, and approach to language
version dependent tests
---
.gitignore | 1 -
.travis.yml | 3 +--
appveyor.yml | 2 +-
features/definitions_transformations.feature | 4 ++--
features/extensions.feature | 2 +-
features/junit_format.feature | 2 +-
features/traits.feature | 3 +--
7 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2c4468f44..fce40dae4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
*.tgz
*.phar
*.phar.asc
-php_version_tags.php
behat.yml
vendor
composer.lock
diff --git a/.travis.yml b/.travis.yml
index 8804bb3c7..d547d2e74 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,11 +37,10 @@ before_script:
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
- export PATH=./bin:$PATH
- - echo " php_version_tags.php
script:
- ./vendor/bin/phpunit
- - behat -fprogress --strict --tags '~@php-version,'`php php_version_tags.php`
+ - behat -fprogress --strict --tags '~@php-version,@php'`php -r 'echo PHP_MAJOR_VERSION;'`
before_deploy:
- curl -LSs https://box-project.github.io/box2/installer.php | php
diff --git a/appveyor.yml b/appveyor.yml
index 5095fe212..3871fe757 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -57,5 +57,5 @@ install:
test_script:
- cd c:\projects\behat
- - php bin\behat --tags="~@php-version,@php53,@php5.2,@php5.1,@php5.0" --format=progress
+ - php bin\behat --tags="~@php-version,@php7" --format=progress
- php vendor\phpunit\phpunit\phpunit --testdox
diff --git a/features/definitions_transformations.feature b/features/definitions_transformations.feature
index 3063d6a13..d24e033ee 100644
--- a/features/definitions_transformations.feature
+++ b/features/definitions_transformations.feature
@@ -420,7 +420,7 @@ Feature: Step Arguments Transformations
8 steps (8 passed)
"""
- @php-version @php7.0
+ @php-version @php7
Scenario: By-type object transformations
Given a file named "features/my.feature" with:
"""
@@ -488,7 +488,7 @@ Feature: Step Arguments Transformations
4 steps (4 passed)
"""
- @php-version @php7.0
+ @php-version @php7
Scenario: By-type and by-name object transformations
Given a file named "features/my.feature" with:
"""
diff --git a/features/extensions.feature b/features/extensions.feature
index eefaa76a7..ab155f4c9 100644
--- a/features/extensions.feature
+++ b/features/extensions.feature
@@ -122,7 +122,7 @@ Feature: Extensions
`inexistent_extension` extension file or class could not be located.
"""
- @php-version @php7.0
+ @php-version @php7
Scenario: Exception handlers extension
Given a file named "behat.yml" with:
"""
diff --git a/features/junit_format.feature b/features/junit_format.feature
index 24997aa2b..aef765ba8 100644
--- a/features/junit_format.feature
+++ b/features/junit_format.feature
@@ -526,7 +526,7 @@
"""
And the file "junit/default.xml" should be a valid document according to "junit.xsd"
- @php-version @php5.3 @php5.4
+ @php-version @php5
Scenario: Aborting due to PHP error
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
diff --git a/features/traits.feature b/features/traits.feature
index dc2c6a519..b4a5f6913 100644
--- a/features/traits.feature
+++ b/features/traits.feature
@@ -1,5 +1,4 @@
-@php-version @php5.4
-Feature: Support php 5.4 traits
+Feature: Support traits
In order to have much cleaner horizontal reusability
As a context developer
I need to be able to use definition traits in my context
From 0b055340efa52cd129984101936f3a52b1a6fd35 Mon Sep 17 00:00:00 2001
From: Christopher Hoult
Date: Thu, 13 Feb 2020 12:12:03 +0000
Subject: [PATCH 197/567] Updated the year on Changelog dates for v3.6.0 and
v3.6.1 to match release dates
---
CHANGELOG.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b2b26442..3fef3b386 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
-## [3.6.1] - 2019-02-06
+## [3.6.1] - 2020-02-06
### Fixed
* [#1278](https://github.com/Behat/Behat/pull/1278): Fix fatal when unexpected symfony/event-dispatcher version is installed
-## [3.6.0] - 2019-02-04
+## [3.6.0] - 2020-02-04
### Added
* [#1244](https://github.com/Behat/Behat/pull/1244): Hide internal steps from stack traces in very verbose mode
### Fixed
From 3af455b72db77680603d64bf830509ab4d543d72 Mon Sep 17 00:00:00 2001
From: Sergey Rabochiy
Date: Tue, 11 Feb 2020 18:50:39 +0700
Subject: [PATCH 198/567] Make container-interop/container-interop optional
dependency
---
.travis.yml | 5 ++-
composer.json | 10 +++---
features/helper_containers.feature | 35 +++++++++++++++++++
.../HelperContainer/ArgumentAutowirer.php | 8 ++---
.../BuiltInServiceContainer.php | 1 -
.../HelperContainer/ContainerInterface.php | 27 ++++++++++++++
.../Exception/ContainerException.php | 27 ++++++++++++++
.../Exception/HelperContainerException.php | 1 -
.../Exception/NotFoundException.php | 27 ++++++++++++++
.../Exception/ServiceNotFoundException.php | 1 -
10 files changed, 129 insertions(+), 13 deletions(-)
create mode 100644 src/Behat/Behat/HelperContainer/ContainerInterface.php
create mode 100644 src/Behat/Behat/HelperContainer/Exception/ContainerException.php
create mode 100644 src/Behat/Behat/HelperContainer/Exception/NotFoundException.php
diff --git a/.travis.yml b/.travis.yml
index d547d2e74..abdf63a18 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,8 @@ matrix:
include:
- php: 5.6
env: DEPENDENCIES='low'
+ - php: 5.6
+ env: SKIP_INTEROP='~@interop&&'
- php: 5.6
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
@@ -34,13 +36,14 @@ before_install:
before_script:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
+ - if [ "$SKIP_INTEROP" != "" ]; then composer remove --dev --no-update container-interop/container-interop; fi;
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
- export PATH=./bin:$PATH
script:
- ./vendor/bin/phpunit
- - behat -fprogress --strict --tags '~@php-version,@php'`php -r 'echo PHP_MAJOR_VERSION;'`
+ - behat -fprogress --strict --tags "$SKIP_INTEROP"'~@php-version,@php'`php -r 'echo PHP_MAJOR_VERSION;'`
before_deploy:
- curl -LSs https://box-project.github.io/box2/installer.php | php
diff --git a/composer.json b/composer.json
index 3dec2c213..2719819a0 100644
--- a/composer.json
+++ b/composer.json
@@ -24,14 +24,14 @@
"symfony/event-dispatcher": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
"symfony/translation": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
"symfony/yaml": "^2.7.51 || ^3.0 || ^4.0 || ^5.0",
- "psr/container": "^1.0",
- "container-interop/container-interop": "^1.2"
+ "psr/container": "^1.0"
},
"require-dev": {
"symfony/process": "~2.5 || ^3.0 || ^4.0 || ^5.0",
"phpunit/phpunit": "^4.8.36 || ^6.3",
- "herrera-io/box": "~1.6.1"
+ "herrera-io/box": "~1.6.1",
+ "container-interop/container-interop": "^1.2"
},
"suggest": {
@@ -44,13 +44,13 @@
"Behat\\Testwork\\": "src/Behat/Testwork/"
}
},
-
+
"autoload-dev": {
"psr-4": {
"Behat\\Tests\\": "tests/"
}
},
-
+
"extra": {
"branch-alias": {
"dev-master": "3.6.x-dev"
diff --git a/features/helper_containers.feature b/features/helper_containers.feature
index 4ef1bddb6..e24d5f0eb 100644
--- a/features/helper_containers.feature
+++ b/features/helper_containers.feature
@@ -177,6 +177,7 @@ Feature: Per-suite helper containers
When I run "behat --no-colors -f progress features/container.feature"
Then it should pass
+ @interop
Scenario: Interop container
Given a file named "behat.yml" with:
"""
@@ -211,6 +212,40 @@ Feature: Per-suite helper containers
When I run "behat --no-colors -f progress features/container.feature"
Then it should pass
+ Scenario: PSR container
+ Given a file named "behat.yml" with:
+ """
+ default:
+ suites:
+ default:
+ contexts:
+ - FirstContext:
+ - "@shared_service"
+ - SecondContext:
+ - "@shared_service"
+
+ services: MyContainer
+ """
+ And a file named "features/bootstrap/MyContainer.php" with:
+ """
+ service) ? $this->service : $this->service = new SharedService();
+ }
+ }
+ """
+ When I run "behat --no-colors -f progress features/container.feature"
+ Then it should pass
+
Scenario: Simplest built-in container configuration
Given a file named "behat.yml" with:
"""
diff --git a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
index 8771eabdc..8fd2712a0 100644
--- a/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
+++ b/src/Behat/Behat/HelperContainer/ArgumentAutowirer.php
@@ -11,7 +11,7 @@
namespace Behat\Behat\HelperContainer;
use Psr\Container\ContainerExceptionInterface;
-use Psr\Container\ContainerInterface;
+use Psr\Container\ContainerInterface as PsrContainerInterface;
use ReflectionFunctionAbstract;
use ReflectionParameter;
use ReflectionException;
@@ -24,16 +24,16 @@
final class ArgumentAutowirer
{
/**
- * @var ContainerInterface
+ * @var PsrContainerInterface
*/
private $container;
/**
* Initialises wirer.
*
- * @param ContainerInterface $container
+ * @param PsrContainerInterface $container
*/
- public function __construct(ContainerInterface $container)
+ public function __construct(PsrContainerInterface $container)
{
$this->container = $container;
}
diff --git a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
index 624bd28e5..fc474436b 100644
--- a/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
+++ b/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php
@@ -12,7 +12,6 @@
use Behat\Behat\HelperContainer\Exception\ServiceNotFoundException;
use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException;
-use Interop\Container\ContainerInterface;
use ReflectionClass;
use ReflectionMethod;
diff --git a/src/Behat/Behat/HelperContainer/ContainerInterface.php b/src/Behat/Behat/HelperContainer/ContainerInterface.php
new file mode 100644
index 000000000..75fb43fa8
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/ContainerInterface.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer;
+
+class_alias(
+ interface_exists('Interop\\Container\\ContainerInterface')
+ ? 'Interop\\Container\\ContainerInterface'
+ : 'Psr\\Container\\ContainerInterface',
+ 'Behat\\Behat\\HelperContainer\\ContainerInterface'
+);
+
+if (false) {
+ /**
+ * @internal
+ */
+ interface ContainerInterface
+ {
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Exception/ContainerException.php b/src/Behat/Behat/HelperContainer/Exception/ContainerException.php
new file mode 100644
index 000000000..fd5543ad0
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/Exception/ContainerException.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer\Exception;
+
+class_alias(
+ interface_exists('Interop\\Container\\Exception\\ContainerException')
+ ? 'Interop\\Container\\Exception\\ContainerException'
+ : 'Psr\\Container\\ContainerExceptionInterface',
+ 'Behat\\Behat\\HelperContainer\\Exception\\ContainerException'
+);
+
+if (false) {
+ /**
+ * @internal
+ */
+ interface ContainerException
+ {
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
index 04ab35f96..d61919225 100644
--- a/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php
@@ -11,7 +11,6 @@
namespace Behat\Behat\HelperContainer\Exception;
use Behat\Testwork\Environment\Exception\EnvironmentException;
-use Interop\Container\Exception\ContainerException;
/**
* All HelperContainer exceptions implement this interface.
diff --git a/src/Behat/Behat/HelperContainer/Exception/NotFoundException.php b/src/Behat/Behat/HelperContainer/Exception/NotFoundException.php
new file mode 100644
index 000000000..739e5181f
--- /dev/null
+++ b/src/Behat/Behat/HelperContainer/Exception/NotFoundException.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Behat\Behat\HelperContainer\Exception;
+
+class_alias(
+ interface_exists('Interop\\Container\\Exception\\NotFoundException')
+ ? 'Interop\\Container\\Exception\\NotFoundException'
+ : 'Psr\\Container\\NotFoundExceptionInterface',
+ 'Behat\\Behat\\HelperContainer\\Exception\\NotFoundException'
+);
+
+if (false) {
+ /**
+ * @internal
+ */
+ interface NotFoundException
+ {
+ }
+}
diff --git a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
index 02bd601b7..a82b63ed0 100644
--- a/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
+++ b/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php
@@ -10,7 +10,6 @@
namespace Behat\Behat\HelperContainer\Exception;
-use Interop\Container\Exception\NotFoundException;
use InvalidArgumentException;
/**
From 8a9585a3547bc612c05c5feb7b39fb4610a47f36 Mon Sep 17 00:00:00 2001
From: Doug Wright
Date: Sat, 15 Feb 2020 21:08:24 +0000
Subject: [PATCH 199/567] Add missing supported PHP versions to CI
---
.travis.yml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index abdf63a18..2cb9392d0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,15 @@ branches:
matrix:
include:
+ - php: 5.3
+ dist: precise
+ env: DEPENDENCIES='low'
+ - php: 5.4
+ dist: trusty
+ env: DEPENDENCIES='low'
+ - php: 5.5
+ dist: trusty
+ env: DEPENDENCIES='low'
- php: 5.6
env: DEPENDENCIES='low'
- php: 5.6
From 72da5306cd7eff7fa7141d8a8eba3c0b9a309c6e Mon Sep 17 00:00:00 2001
From: Doug Wright
Date: Sat, 15 Feb 2020 21:07:58 +0000
Subject: [PATCH 200/567] Remove PHP5.5isms
---
.../Definition/Translator/TranslatorInterface.php | 4 ++--
.../EventDispatcher/TestworkEventDispatcher.php | 10 +++++-----
.../Configuration/ConfigurationTree.php | 2 +-
.../Definition/Pattern/PatternTransformerTest.php | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
index 9ad91e381..75418211a 100644
--- a/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
+++ b/src/Behat/Behat/Definition/Translator/TranslatorInterface.php
@@ -2,11 +2,11 @@
namespace Behat\Behat\Definition\Translator;
-if (interface_exists(\Symfony\Contracts\Translation\TranslatorInterface::class)) {
+if (interface_exists('\Symfony\Contracts\Translation\TranslatorInterface')) {
interface TranslatorInterface extends \Symfony\Contracts\Translation\TranslatorInterface
{
}
-} elseif (interface_exists(\Symfony\Component\Translation\TranslatorInterface::class)) {
+} elseif (interface_exists('\Symfony\Component\Translation\TranslatorInterface')) {
interface TranslatorInterface extends \Symfony\Component\Translation\TranslatorInterface
{
}
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 0523301d3..2020a60a8 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -18,7 +18,7 @@
* @author Konstantin Kudryashov
*/
$identifyEventDispatcherClassVersion = function() {
- $reflection = new \ReflectionClass(\Symfony\Component\EventDispatcher\EventDispatcher::class);
+ $reflection = new \ReflectionClass('\Symfony\Component\EventDispatcher\EventDispatcher');
$dispatch = $reflection->getMethod('dispatch');
if ($dispatch->getNumberOfParameters() === 1) {
@@ -26,7 +26,7 @@
// internally uses func_get_args to work parameters it got in what order. The legacy Testwork class can still
// extend this because its signature only adds an extra optional param. It may however produce unexpected
// results as it assumes all dispatch calls are with the legacy sequence of $eventName, $event.
- return TestworkEventDispatcherSymfonyLegacy::class;
+ return 'Behat\Testwork\EventDispatcher\TestworkEventDispatcherSymfonyLegacy';
}
$first_param = $dispatch->getParameters()[0];
@@ -34,19 +34,19 @@
case 'event':
// This is the new Symfony 5 event dispatcher interface
// public function dispatch(object $event, string $eventName = null): object
- return TestworkEventDispatcherSymfony5::class;
+ return 'Behat\Testwork\EventDispatcher\TestworkEventDispatcherSymfony5';
case 'eventName':
// This is the Symfony <= 4.2 version
// public function dispatch($eventName, Event $event = null)
- return TestworkEventDispatcherSymfonyLegacy::class;
+ return 'Behat\Testwork\EventDispatcher\TestworkEventDispatcherSymfonyLegacy';
default:
throw new \UnexpectedValueException('Could not identify which version of symfony/event-dispatcher is in use, could not define a compatible TestworkEventDispatcher');
}
};
-class_alias($identifyEventDispatcherClassVersion(), \Behat\Testwork\EventDispatcher\TestworkEventDispatcher::class);
+class_alias($identifyEventDispatcherClassVersion(), '\Behat\Testwork\EventDispatcher\TestworkEventDispatcher');
unset($identifyEventDispatcherClassVersion);
diff --git a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
index 7fe010956..3c3f317ec 100644
--- a/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
+++ b/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php
@@ -31,7 +31,7 @@ final class ConfigurationTree
*/
public function getConfigTree(array $extensions)
{
- if (method_exists(TreeBuilder::class, 'getRootNode')) {
+ if (method_exists('Symfony\Component\Config\Definition\Builder\TreeBuilder', 'getRootNode')) {
$treeBuilder = new TreeBuilder('testwork');
/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();
diff --git a/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
index 44aca4825..4a2c45462 100644
--- a/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
+++ b/tests/Behat/Tests/Definition/Pattern/PatternTransformerTest.php
@@ -14,7 +14,7 @@ class PatternTransformerTest extends TestCase
{
public function testTransformPatternToRegexCache()
{
- $observer = $this->prophesize(PatternPolicy::class);
+ $observer = $this->prophesize('Behat\Behat\Definition\Pattern\Policy\PatternPolicy');
// first pattern
$observer->supportsPattern('hello world')->willReturn(true);
$observer->transformPatternToRegex('hello world')
@@ -42,14 +42,14 @@ public function testTransformPatternToRegexCache()
public function testTransformPatternToRegexCacheAndRegisterNewPolicy()
{
// first pattern
- $policy1Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy1Prophecy = $this->prophesize('Behat\Behat\Definition\Pattern\Policy\PatternPolicy');
$policy1Prophecy->supportsPattern('hello world')->willReturn(true);
$policy1Prophecy->transformPatternToRegex('hello world')
->shouldBeCalledTimes(2)
->willReturn('/hello world/');
// second pattern
- $policy2Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy2Prophecy = $this->prophesize('Behat\Behat\Definition\Pattern\Policy\PatternPolicy');
$policy1Prophecy->supportsPattern()->shouldNotBeCalled();
$policy1Prophecy->transformPatternToRegex()->shouldNotBeCalled();
@@ -73,7 +73,7 @@ public function testTransformPatternToRegexCacheAndRegisterNewPolicy()
public function testTransformPatternToRegexNoMatch()
{
// first pattern
- $policy1Prophecy = $this->prophesize(PatternPolicy::class);
+ $policy1Prophecy = $this->prophesize('Behat\Behat\Definition\Pattern\Policy\PatternPolicy');
$policy1Prophecy->supportsPattern('hello world')->willReturn(false);
$policy1Prophecy->transformPatternToRegex('hello world')
->shouldNotBeCalled();
From dfba74516d64f3da6457710465da84560e816de8 Mon Sep 17 00:00:00 2001
From: Doug Wright
Date: Sat, 15 Feb 2020 21:47:17 +0000
Subject: [PATCH 201/567] Remove PHP5.4ism
---
features/bootstrap/FeatureContext.php | 2 +-
src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php
index 4aaf6f795..bbf45921d 100644
--- a/features/bootstrap/FeatureContext.php
+++ b/features/bootstrap/FeatureContext.php
@@ -41,7 +41,7 @@ class FeatureContext implements Context
/**
* @var array
*/
- private $env = [];
+ private $env = array();
/**
* @var string
*/
diff --git a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
index 2020a60a8..8bd215c88 100644
--- a/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
+++ b/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php
@@ -29,7 +29,8 @@
return 'Behat\Testwork\EventDispatcher\TestworkEventDispatcherSymfonyLegacy';
}
- $first_param = $dispatch->getParameters()[0];
+ $params = $dispatch->getParameters();
+ $first_param = reset($params);
switch ($first_param->getName()) {
case 'event':
// This is the new Symfony 5 event dispatcher interface
From ec83ffa08aa874b0161e789b1f25176c169351e4 Mon Sep 17 00:00:00 2001
From: Doug Wright