Skip to content

Commit c163ff3

Browse files
Merge branch '5.7' into 6.5
2 parents 51cae63 + 7fbc25c commit c163ff3

File tree

7 files changed

+71
-7
lines changed

7 files changed

+71
-7
lines changed

ChangeLog-5.7.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
All notable changes of the PHPUnit 5.7 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
44

5-
## [5.7.26] - 2017-MM-DD
5+
## [5.7.26] - 2017-12-17
66

77
### Fixed
88

99
* Fixed [#2472](https://github.com/sebastianbergmann/phpunit/issues/2472): `PHPUnit\Util\Getopt` uses deprecated `each()` function
1010
* Fixed [#2833](https://github.com/sebastianbergmann/phpunit/issues/2833): Test class loaded during data provider execution is not discovered
11+
* Fixed [#2922](https://github.com/sebastianbergmann/phpunit/issues/2922): Test class is not discovered when there is a test class with `@group` and provider throwing exception in it, tests are run with `--exclude-group` for that group, there is another class called later (after the class from above), and the name of that another class does not match its filename
1112

1213
## [5.7.25] - 2017-11-14
1314

ChangeLog-6.5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 6.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
44

5+
## [6.5.5] - 2017-MM-DD
6+
7+
### Fixed
8+
9+
* Fixed [#2922](https://github.com/sebastianbergmann/phpunit/issues/2922): Test class is not discovered when there is a test class with `@group` and provider throwing exception in it, tests are run with `--exclude-group` for that group, there is another class called later (after the class from above), and the name of that another class does not match its filename
10+
511
## [6.5.4] - 2017-12-10
612

713
### Changed
@@ -36,6 +42,7 @@ All notable changes of the PHPUnit 6.5 release series are documented in this fil
3642
* Fixed [#2654](https://github.com/sebastianbergmann/phpunit/issues/2654): Problems with `assertJsonStringEqualsJsonString()`
3743
* Fixed [#2810](https://github.com/sebastianbergmann/phpunit/pull/2810): Code Coverage for PHPT tests does not work
3844

45+
[6.5.5]: https://github.com/sebastianbergmann/phpunit/compare/6.5.4...6.5.5
3946
[6.5.4]: https://github.com/sebastianbergmann/phpunit/compare/6.5.3...6.5.4
4047
[6.5.3]: https://github.com/sebastianbergmann/phpunit/compare/6.5.2...6.5.3
4148
[6.5.2]: https://github.com/sebastianbergmann/phpunit/compare/6.5.1...6.5.2

src/Framework/TestSuite.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,12 @@ public function addTestFile($filename)
358358
}
359359

360360
foreach ($newClasses as $className) {
361-
if ($className === DataProviderTestSuite::class) {
361+
$class = new ReflectionClass($className);
362+
363+
if (dirname($class->getFileName()) === __DIR__) {
362364
continue;
363365
}
364366

365-
$class = new ReflectionClass($className);
366-
367367
if (!$class->isAbstract()) {
368368
if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) {
369369
$method = $class->getMethod(
@@ -746,7 +746,7 @@ public function run(TestResult $result = null)
746746
}
747747

748748
if ($test instanceof TestCase || $test instanceof self) {
749-
$test->setbeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState);
749+
$test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState);
750750
$test->setBackupGlobals($this->backupGlobals);
751751
$test->setBackupStaticAttributes($this->backupStaticAttributes);
752752
$test->setRunTestInSeparateProcess($this->runTestInSeparateProcess);
@@ -949,7 +949,7 @@ protected static function incompleteTest($class, $methodName, $message)
949949
/**
950950
* @param bool $beStrictAboutChangesToGlobalState
951951
*/
952-
public function setbeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState)
952+
public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState)
953953
{
954954
if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) {
955955
$this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState;

src/TextUI/TestRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function doRun(Test $suite, array $arguments = [], $exit = true)
205205
}
206206

207207
if ($arguments['beStrictAboutChangesToGlobalState'] === true) {
208-
$suite->setbeStrictAboutChangesToGlobalState(true);
208+
$suite->setBeStrictAboutChangesToGlobalState(true);
209209
}
210210

211211
if (\is_int($arguments['repeat']) && $arguments['repeat'] > 0) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
phpunit --exclude-group=foo ../_files/DataProviderIssue2922
3+
--FILE--
4+
<?php
5+
$_SERVER['argv'][1] = '--no-configuration';
6+
$_SERVER['argv'][2] = '--exclude-group=foo';
7+
$_SERVER['argv'][3] = __DIR__ . '/../_files/DataProviderIssue2922';
8+
9+
require __DIR__ . '/../bootstrap.php';
10+
PHPUnit\TextUI\Command::main();
11+
--EXPECTF--
12+
PHPUnit %s by Sebastian Bergmann and contributors.
13+
14+
. 1 / 1 (100%)
15+
16+
Time: %s, Memory: %s
17+
18+
OK (1 test, 1 assertion)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Foo\DataProviderIssue2922;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
/**
8+
* @group foo
9+
*/
10+
class FirstTest extends TestCase
11+
{
12+
/**
13+
* @dataProvider provide
14+
*/
15+
public function testFirst($x)
16+
{
17+
$this->assertTrue(true);
18+
}
19+
20+
public function provide()
21+
{
22+
throw new \Exception();
23+
}
24+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Foo\DataProviderIssue2922;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
// the name of the class cannot match file name - if they match all is fine
8+
class SecondHelloWorldTest extends TestCase
9+
{
10+
public function testSecond()
11+
{
12+
$this->assertTrue(true);
13+
}
14+
}

0 commit comments

Comments
 (0)