mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Merge pull request #748 from ncharalampidis/2.x
Fix parallel execution of test class that extends another class with same name
This commit is contained in:
@ -92,7 +92,7 @@ $bootPest = (static function (): void {
|
||||
exit;
|
||||
}
|
||||
|
||||
$exitCode = $application->runTest(trim($testPath));
|
||||
$exitCode = $application->runTest(realpath(trim($testPath)));
|
||||
|
||||
fwrite($statusFile, (string) $exitCode);
|
||||
fflush($statusFile);
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\Fixtures\\Covers\\": "tests/Fixtures/Covers",
|
||||
"Tests\\Fixtures\\Inheritance\\": "tests/Fixtures/Inheritance",
|
||||
"Tests\\": "tests/PHPUnit/"
|
||||
},
|
||||
"files": [
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
<directory suffix=".php">./tests</directory>
|
||||
<exclude>./tests/.snapshots</exclude>
|
||||
<exclude>./tests/.tests</exclude>
|
||||
<exclude>./tests/Fixtures/Inheritance</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage>
|
||||
|
||||
@ -8,4 +8,10 @@
|
||||
PASS Tests\Fixtures\ExampleTest
|
||||
✓ it example 2
|
||||
|
||||
Tests: 2 skipped, 2 passed (2 assertions)
|
||||
WARN Tests\Fixtures\Inheritance\Base\ExampleTest
|
||||
- example
|
||||
|
||||
PASS Tests\Fixtures\Inheritance\ExampleTest
|
||||
✓ example
|
||||
|
||||
Tests: 3 skipped, 3 passed (3 assertions)
|
||||
|
||||
@ -988,6 +988,7 @@
|
||||
|
||||
PASS Tests\Visual\Parallel
|
||||
✓ parallel
|
||||
✓ a parallel test can extend another test with same name
|
||||
|
||||
PASS Tests\Visual\SingleTestOrDirectory
|
||||
✓ allows to run a single test
|
||||
@ -1008,4 +1009,4 @@
|
||||
PASS Tests\Visual\Version
|
||||
✓ visual snapshot of help command output
|
||||
|
||||
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 705 passed (1706 assertions)
|
||||
Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 14 skipped, 706 passed (1707 assertions)
|
||||
13
tests/Fixtures/Inheritance/Base/ExampleTest.php
Normal file
13
tests/Fixtures/Inheritance/Base/ExampleTest.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fixtures\Inheritance\Base;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
public function testExample()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
}
|
||||
11
tests/Fixtures/Inheritance/ExampleTest.php
Normal file
11
tests/Fixtures/Inheritance/ExampleTest.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fixtures\Inheritance;
|
||||
|
||||
class ExampleTest extends Base\ExampleTest
|
||||
{
|
||||
public function testExample()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,9 @@
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
$run = function () {
|
||||
$process = new Process(['php', 'bin/pest', '--parallel', '--processes=3', '--exclude-group=integration'], dirname(__DIR__, 2),
|
||||
$process = new Process(
|
||||
array_merge(['php', 'bin/pest', '--parallel', '--processes=3'], func_get_args()),
|
||||
dirname(__DIR__, 2),
|
||||
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
|
||||
);
|
||||
|
||||
@ -15,6 +17,11 @@ $run = function () {
|
||||
};
|
||||
|
||||
test('parallel', function () use ($run) {
|
||||
expect($run())->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 694 passed (1692 assertions)')
|
||||
expect($run('--exclude-group=integration'))
|
||||
->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 694 passed (1692 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skip(PHP_OS_FAMILY === 'Windows');
|
||||
|
||||
test('a parallel test can extend another test with same name', function () use ($run) {
|
||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 1 passed (1 assertions)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user