mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
Adds a new method, isInParallel, to the Testable trait to allow a test to determine its parallel status.
This commit is contained in:
@ -485,6 +485,11 @@
|
||||
✓ 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
|
||||
@ -647,5 +652,5 @@
|
||||
✓ it is a test
|
||||
✓ it uses correct parent class
|
||||
|
||||
Tests: 4 incompleted, 9 skipped, 419 passed
|
||||
Tests: 4 incompleted, 10 skipped, 421 passed
|
||||
|
||||
15
tests/Features/Parallel.php
Normal file
15
tests/Features/Parallel.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?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(); });
|
||||
Reference in New Issue
Block a user