Skip to content

Commit

Permalink
fix regression sebastianbergmann#3889
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Oct 10, 2019
1 parent cba1d15 commit 145742b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Runner/StandardTestSuiteLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\Runner;

use PHPUnit\Framework\TestCase;
use PHPUnit\Util\FileLoader;
use PHPUnit\Util\Filesystem;
use ReflectionClass;
Expand Down Expand Up @@ -62,6 +63,12 @@ public function load(string $suiteClassName, string $suiteClassFile = ''): Refle

break;
}

if ($class->isSubclassOf(TestCase::class)) {
$suiteClassName = $loadedClass;

break;
}
}

if (!\class_exists($suiteClassName, false) ||
Expand Down
18 changes: 18 additions & 0 deletions tests/end-to-end/regression/GitHub/3889-2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/3889
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][4] = __DIR__ . '/3889/MyIssue3889Test.php';

require __DIR__ . '/../../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: %s, Memory: %s

OK (1 test, 1 assertion)
20 changes: 20 additions & 0 deletions tests/end-to-end/regression/GitHub/3889.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/3889
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--test-suffix';
$_SERVER['argv'][3] = '.test.php';
$_SERVER['argv'][4] = __DIR__ . '/3889/Issue3889Test.test.php';

require __DIR__ . '/../../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: %s, Memory: %s

OK (1 test, 1 assertion)
18 changes: 18 additions & 0 deletions tests/end-to-end/regression/GitHub/3889/Issue3889Test.test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\TestCase;

final class Issue3889Test extends TestCase
{
public function testOne(): void
{
$this->assertTrue(true);
}
}
18 changes: 18 additions & 0 deletions tests/end-to-end/regression/GitHub/3889/MyIssue3889Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\TestCase;

final class Issue3889Test extends TestCase
{
public function testOne(): void
{
$this->assertTrue(true);
}
}

0 comments on commit 145742b

Please sign in to comment.