Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PhpUnit 10 and Symfony 7 #16

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
php: 8.0
- phpunit: 9.5.26
php: 8.1
- phpunit: 10.5.38
php: 8.1
- phpunit: 10.5.38
php: 8.2
- phpunit: 10.5.38
php: 8.3

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
],
"require": {
"php": "^7.0 || ^8.0",
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10",
"behat/behat": "^3.0.0",
"symfony/dependency-injection": "^4.0 || ^5.0 || ^6.0"
"symfony/dependency-injection": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 10 additions & 0 deletions src/Behat/Testwork/Environment/PHPUnitEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ class PHPUnitEnvironment implements ContextEnvironment
*/
protected $contextClasses = array();

/**
* @var Suite
*/
protected $suite;

/**
* @var TestCase
*/
protected $testCase;

/**
* Specifies the current PhpUnit test case.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
class HasScenarioPassedConstraint extends Constraint
{

/**
* The behat environment.
*
* @var \PHPUnitBehat\Behat\Testwork\Environment\PHPUnitEnvironment
*/
protected $environment;

/**
* The behat scenario.
*
Expand Down
16 changes: 14 additions & 2 deletions src/TestTraits/BehatProvidingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ public function getBehatDefaultKeywords() {
* @return \Behat\Gherkin\Node\KeywordNodeInterface
*/
protected function getProvidedFeature() {
$data = $this->getProvidedData();
$data = NULL;
if (method_exists($this, 'getProvidedData')) {
$data = $this->getProvidedData();
}
elseif (method_exists($this, 'providedData')) {
$data = $this->providedData();
}
if (is_array($data) && $feature = $data[1]) {
if ($feature instanceof KeywordNodeInterface) {
return $feature;
Expand All @@ -128,7 +134,13 @@ protected function getProvidedFeature() {
* The current scenario or example.
*/
protected function getProvidedScenario() {
$data = $this->getProvidedData();
$data = NULL;
if (method_exists($this, 'getProvidedData')) {
$data = $this->getProvidedData();
}
elseif (method_exists($this, 'providedData')) {
$data = $this->providedData();
}
if (is_array($data) && $scenario = $data[0]) {
if ($scenario instanceof ScenarioInterface) {
return $scenario;
Expand Down
2 changes: 1 addition & 1 deletion tests/AssertionFailedWrapperErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
*
*/
class AssertionFailedWrappedErrorTest extends TestCase {
class AssertionFailedWrapperErrorTest extends TestCase {

use TestDefinitionsTrait;

Expand Down
Loading