Skip to content

Commit

Permalink
Support PhpUnit 10 and Symfony 7 (#16)
Browse files Browse the repository at this point in the history
* #1118: Added PhpUnit 10 and Symfony 7 requirements for composer.json. Updated CI tests to test PHPUnit 10 version for latest PHP 8.x versions.

* 1118 - Add new property

* 1118 - Add new property

* 1118 - Add new property

* 1118 - Add new property

* 1118 - Add new property

---------

Co-authored-by: Yevhen Korniievskyi <[email protected]>
Co-authored-by: AstonVictor <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 8cc5345 commit 4060948
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 5 deletions.
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

0 comments on commit 4060948

Please sign in to comment.