Merge branch '2.x' into 3.x

This commit is contained in:
Nuno Maduro
2024-08-22 21:21:52 +01:00
10 changed files with 75 additions and 1588 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
use Pest\Exceptions\DatasetMissing;
use Pest\Exceptions\TestAlreadyExist;
use Pest\Exceptions\TestClosureMustNotBeStatic;
use Pest\Factories\TestCaseMethodFactory;
use Pest\TestSuite;
@ -17,6 +18,16 @@ it('does not allow to add the same test description twice', function () {
sprintf('A test with the description `%s` already exists in the filename `%s`.', 'bar', 'foo'),
);
it('does not allow static closures', function () {
$testSuite = new TestSuite(getcwd(), 'tests');
$method = new TestCaseMethodFactory('foo', 'bar', static function () {});
$testSuite->tests->set($method);
})->throws(
TestClosureMustNotBeStatic::class,
'Test closure must not be static. Please remove the `static` keyword from the `bar` method in `foo`.',
);
it('alerts users about tests with arguments but no input', function () {
$testSuite = new TestSuite(getcwd(), 'tests');

View File

@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) {
expect($run('--exclude-group=integration'))
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1074 passed (2616 assertions)')
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 17 todos, 19 skipped, 1075 passed (2617 assertions)')
->toContain('Parallel: 3 processes');
})->skipOnWindows();