mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Removes isInParallel
This commit is contained in:
@ -304,12 +304,4 @@ trait Testable
|
||||
{
|
||||
return ltrim(self::class, 'P\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether this test case is being executed in a parallel environment.
|
||||
*/
|
||||
public function isInParallel(): bool
|
||||
{
|
||||
return TestSuite::getInstance()->isInParallel;
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,13 +73,6 @@ final class TestSuite
|
||||
*/
|
||||
public $testPath;
|
||||
|
||||
/**
|
||||
* Whether this test is running as part of a parallel suite.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isInParallel = false;
|
||||
|
||||
/**
|
||||
* Holds an instance of the test suite.
|
||||
*
|
||||
|
||||
@ -485,11 +485,6 @@
|
||||
✓ it can call chained macro method
|
||||
✓ it will throw exception from call if no macro exists
|
||||
|
||||
WARN Tests\Features\Parallel
|
||||
- it can determine in the test case if it is running in parallel
|
||||
✓ it can determine in the test case if it is not running in parallel
|
||||
✓ it can skip using the test case based on parallel status
|
||||
|
||||
PASS Tests\Features\PendingHigherOrderTests
|
||||
✓ get 'foo'
|
||||
✓ get 'foo' → get 'bar' → expect true → toBeTrue
|
||||
@ -652,5 +647,5 @@
|
||||
✓ it is a test
|
||||
✓ it uses correct parent class
|
||||
|
||||
Tests: 4 incompleted, 10 skipped, 421 passed
|
||||
Tests: 4 incompleted, 9 skipped, 419 passed
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
it('can determine in the test case if it is running in parallel', function () {
|
||||
expect(test()->isInParallel())->toBeTrue();
|
||||
})->skip(!TestSuite::getInstance()->isInParallel);
|
||||
|
||||
it('can determine in the test case if it is not running in parallel', function () {
|
||||
expect(test()->isInParallel())->toBeFalse();
|
||||
})->skip(TestSuite::getInstance()->isInParallel);
|
||||
|
||||
it('can skip using the test case based on parallel status', function () {
|
||||
expect(TestSuite::getInstance()->isInParallel)->toBeFalse();
|
||||
})->skip(function () { return $this->isInParallel(); });
|
||||
@ -1,14 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Pest\Support\Str;
|
||||
use Pest\TestSuite;
|
||||
|
||||
global $globalHook;
|
||||
|
||||
// HACK: we have to determine our $globalHook->calls baseline. This is because
|
||||
// two other tests are executed before this one due to filename ordering.
|
||||
$args = $_SERVER['argv'] ?? [];
|
||||
$single = (isset($args[1]) && Str::endsWith(__FILE__, $args[1])) || TestSuite::getInstance()->isInParallel;
|
||||
$single = (isset($args[1]) && Str::endsWith(__FILE__, $args[1])) || ($_SERVER['PEST_PARALLEL'] ?? false);
|
||||
$offset = $single ? 0 : 2;
|
||||
|
||||
uses()->beforeAll(function () use ($globalHook, $offset) {
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
test('closure was bound to CustomTestCase', function () {
|
||||
$this->assertCustomInSubFolderTrue();
|
||||
})->skip(TestSuite::getInstance()->isInParallel, 'Nested Pest.php files are not loaded in parallel.');
|
||||
});
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Tests\CustomTestCaseInSubFolders\SubFolder\SubFolder\CustomTestCaseInSubFolder;
|
||||
|
||||
uses(CustomTestCaseInSubFolder::class)->in('CustomTestCaseInSubFolders/SubFolder');
|
||||
@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Tests\CustomTestCaseInSubFolders\SubFolder\SubFolder\CustomTestCaseInSubFolder;
|
||||
|
||||
uses(CustomTestCaseInSubFolder::class)->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder');
|
||||
|
||||
uses()->group('integration')->in('Visual');
|
||||
|
||||
// NOTE: global test value container to be mutated and checked across files, as needed
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Pest\TestSuite;
|
||||
|
||||
test('visual snapshot of test suite on success', function () {
|
||||
$testsPath = dirname(__DIR__);
|
||||
$snapshot = implode(DIRECTORY_SEPARATOR, [
|
||||
@ -11,7 +9,7 @@ test('visual snapshot of test suite on success', function () {
|
||||
]);
|
||||
|
||||
$output = function () use ($testsPath) {
|
||||
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest'], dirname($testsPath), ['EXCLUDE' => 'integration', 'REBUILD_SNAPSHOTS' => false]));
|
||||
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest'], dirname($testsPath), ['EXCLUDE' => 'integration', 'REBUILD_SNAPSHOTS' => false, 'PARATEST' => 0]));
|
||||
|
||||
$process->run();
|
||||
|
||||
@ -37,5 +35,4 @@ test('visual snapshot of test suite on success', function () {
|
||||
expect(implode("\n", $output))->toContain(file_get_contents($snapshot));
|
||||
}
|
||||
})->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
|
||||
->skip(TestSuite::getInstance()->isInParallel)
|
||||
->skip(PHP_OS_FAMILY === 'Windows');
|
||||
|
||||
Reference in New Issue
Block a user