Skip to content

Commit

Permalink
Iterate PHPUnit test suite correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
aik099 committed Mar 16, 2024
1 parent fe5911c commit 1c7a6e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed
- Don't set remote code coverage collection cookies, when the remote code coverage script URL isn't specified.
- The `BrowserTestCase::onTestSuiteEnded` method was called for tests, excluded through the `--filter` option of the PHPUnit.

## [2.3.0] - 2022-11-24
### Changed
Expand Down
12 changes: 6 additions & 6 deletions library/aik099/PHPUnit/TestSuite/AbstractTestSuite.php
Expand Up @@ -134,24 +134,24 @@ public function runCompat($result = null)
/**
* Report back suite ending to each it's test.
*
* @param array $tests Tests to process.
* @param \IteratorAggregate|null $test_suite Test suite.
*
* @return void
*/
protected function triggerTestSuiteEnded(array $tests = null)
protected function triggerTestSuiteEnded(\IteratorAggregate $test_suite = null)
{
if ( !isset($tests) ) {
$tests = $this->tests();
if ( $test_suite === null ) {
$test_suite = $this;
}

foreach ( $tests as $test ) {
foreach ( $test_suite as $test ) {
if ( $test instanceof DataProviderTestSuite ) {
/*
* Use our test suite method to tear down
* supported test suites wrapped in a data
* provider test suite.
*/
$this->triggerTestSuiteEnded($test->tests());
$this->triggerTestSuiteEnded($test);
}
else {
/*
Expand Down

0 comments on commit 1c7a6e2

Please sign in to comment.