mirror of
https://github.com/pestphp/pest.git
synced 2026-04-20 22:20:17 +02:00
Merge branch '4.x' into fix/unicode-filename-filter
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
test('collision', function (array $arguments) {
|
||||
$output = function () use ($arguments) {
|
||||
$process = (new Symfony\Component\Process\Process(
|
||||
$process = (new Process(
|
||||
array_merge(['php', 'bin/pest', 'tests/Fixtures/CollisionTest.php'], $arguments),
|
||||
null,
|
||||
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'COLLISION_TEST' => true]
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
test('visual snapshot of help command output', function () {
|
||||
$output = function () {
|
||||
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
|
||||
$process = (new Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
|
||||
|
||||
$process->run();
|
||||
|
||||
|
||||
@ -16,10 +16,17 @@ $run = function () {
|
||||
|
||||
test('parallel', function () use ($run) {
|
||||
expect($run('--exclude-group=integration'))
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 26 skipped, 1177 passed (2789 assertions)')
|
||||
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 3 notices, 39 todos, 26 skipped, 1196 passed (2809 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
test('a parallel test can extend another test with same name', function () use ($run) {
|
||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 2 passed (2 assertions)');
|
||||
});
|
||||
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 1 passed (1 assertions)');
|
||||
})->skipOnWindows();
|
||||
|
||||
test('parallel reports invalid datasets as failures', function () use ($run) {
|
||||
expect($run('tests/.tests/ParallelInvalidDataset'))
|
||||
->toContain("A dataset with the name `missing.dataset` does not exist. You can create it using `dataset('missing.dataset', ['a', 'b']);`.")
|
||||
->toContain('Tests: 1 failed, 1 passed (1 assertions)')
|
||||
->toContain('Parallel: 3 processes');
|
||||
})->skipOnWindows();
|
||||
|
||||
40
tests/Visual/ParallelNestedDatasets.php
Normal file
40
tests/Visual/ParallelNestedDatasets.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
$run = function (bool $parallel = false): array {
|
||||
$command = [
|
||||
'php',
|
||||
'bin/pest',
|
||||
'tests/Fixtures/ParallelNestedDatasets/TestFileWithNestedDataset.php',
|
||||
'--colors=never',
|
||||
];
|
||||
|
||||
if ($parallel) {
|
||||
$command[] = '--parallel';
|
||||
$command[] = '--processes=2';
|
||||
}
|
||||
|
||||
$process = new Process($command, dirname(__DIR__, 2),
|
||||
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
|
||||
);
|
||||
|
||||
$process->run();
|
||||
|
||||
return [
|
||||
'exitCode' => $process->getExitCode(),
|
||||
'output' => removeAnsiEscapeSequences($process->getOutput().$process->getErrorOutput()),
|
||||
];
|
||||
};
|
||||
|
||||
test('parallel loads nested datasets from nested directories', function () use ($run) {
|
||||
$serial = $run();
|
||||
$parallel = $run(true);
|
||||
|
||||
expect($serial['exitCode'])->toBe(0)
|
||||
->and($parallel['exitCode'])->toBe(0)
|
||||
->and($serial['output'])->toContain('Tests: 2 passed (2 assertions)')
|
||||
->and($parallel['output'])->toContain('Tests: 2 passed (2 assertions)')
|
||||
->and($parallel['output'])->toContain('Parallel: 2 processes')
|
||||
->and($parallel['output'])->not->toContain('No tests found.');
|
||||
})->skipOnWindows();
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
test('visual snapshot of test suite on success', function () {
|
||||
$testsPath = dirname(__DIR__);
|
||||
$snapshot = implode(DIRECTORY_SEPARATOR, [
|
||||
@ -9,8 +11,8 @@ test('visual snapshot of test suite on success', function () {
|
||||
]);
|
||||
|
||||
$output = function () use ($testsPath) {
|
||||
$process = (new Symfony\Component\Process\Process(
|
||||
['php', 'bin/pest'],
|
||||
$process = (new Process(
|
||||
['php', '-d', 'memory_limit=256M', 'bin/pest'],
|
||||
dirname($testsPath),
|
||||
['EXCLUDE' => 'integration', '--exclude-group' => 'integration', 'REBUILD_SNAPSHOTS' => false, 'PARATEST' => 0, 'COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
|
||||
));
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
function normalize_windows_os_output(string $text): string
|
||||
{
|
||||
$text = str_replace('\r', '', $text);
|
||||
@ -17,7 +19,7 @@ test('visual snapshot of team city', function (string $testFile) {
|
||||
]);
|
||||
|
||||
$output = function () use ($testsPath) {
|
||||
$process = (new Symfony\Component\Process\Process(
|
||||
$process = (new Process(
|
||||
['php', 'bin/pest', '--teamcity', $testsPath],
|
||||
dirname(__DIR__, levels: 2),
|
||||
[
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
test('visual snapshot of help command output', function () {
|
||||
$output = function () {
|
||||
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest', '--version'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
|
||||
$process = (new Process(['php', 'bin/pest', '--version'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
|
||||
|
||||
$process->run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user