fix: package lock fingerprint

This commit is contained in:
nuno maduro
2026-07-18 01:10:01 +01:00
parent 9e79e491e2
commit 820fa08313
237 changed files with 2409 additions and 2100 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
<?php
beforeEach(function () {
beforeEach(function (): void {
$this->description = $this->__description;
$this->latestDescription = self::$__latestDescription;
});
test('description', function () {
test('description', function (): void {
expect($this->description)->toBe('description');
});
test('latest description', function () {
test('latest description', function (): void {
expect($this->latestDescription)->toBe('latest description');
});
+4 -4
View File
@@ -2,12 +2,12 @@
use Symfony\Component\Process\Process;
test('collision', function (array $arguments) {
$output = function () use ($arguments) {
test('collision', function (array $arguments): void {
$output = function () use ($arguments): ?string {
$process = (new Process(
array_merge(['php', 'bin/pest', 'tests/Fixtures/CollisionTest.php'], $arguments),
null,
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'COLLISION_TEST' => true]
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'COLLISION_TEST' => true, 'PAO_DISABLE' => '1']
));
$process->run();
@@ -15,7 +15,7 @@ test('collision', function (array $arguments) {
return removeAnsiEscapeSequences($process->getOutput());
};
$outputContent = explode("\n", $output());
$outputContent = explode("\n", (string) $output());
array_pop($outputContent);
array_pop($outputContent);
array_pop($outputContent);
+3 -3
View File
@@ -2,9 +2,9 @@
use Symfony\Component\Process\Process;
test('visual snapshot of help command output', function () {
$output = function () {
$process = (new Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
test('visual snapshot of help command output', function (): void {
$output = function (): ?string {
$process = (new Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']));
$process->run();
+9 -27
View File
@@ -8,7 +8,7 @@ $run = function () {
$process = new Process(
array_merge(['php', 'bin/pest', '--log-junit', $junitLogFile], func_get_args()),
dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
);
$process->run();
@@ -26,11 +26,9 @@ $run = function () {
}
};
$normalizedPath = function (string $path) {
return str_replace('/', DIRECTORY_SEPARATOR, $path);
};
$normalizedPath = (fn (string $path): string => str_replace('/', DIRECTORY_SEPARATOR, $path));
test('junit output', function () use ($normalizedPath, $run) {
test('junit output', function () use ($normalizedPath, $run): void {
$result = $run('tests/.tests/SuccessOnly.php');
expect($result['testsuite']['@attributes'])
@@ -40,21 +38,12 @@ test('junit output', function () use ($normalizedPath, $run) {
->assertions->toBe('4')
->errors->toBe('0')
->failures->toBe('0')
->skipped->toBe('0');
expect($result['testsuite']['testcase'])
->toHaveCount(2);
expect($result['testsuite']['testcase'][0]['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
->time->toStartWith('0.0');
->skipped->toBe('0')
->and($result['testsuite']['testcase'])->toHaveCount(2)
->and($result['testsuite']['testcase'][0]['@attributes'])->name->toBe('it can pass with comparison')->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))->class->toBe('Tests\tests\SuccessOnly')->classname->toBe('Tests.tests.SuccessOnly')->assertions->toBe('1')->time->toStartWith('0.0');
});
test('junit with parallel', function () use ($normalizedPath, $run) {
test('junit with parallel', function () use ($normalizedPath, $run): void {
$result = $run('tests/.tests/SuccessOnly.php', '--parallel', '--processes=1', '--filter', 'can pass with comparison');
expect($result['testsuite']['@attributes'])
@@ -64,13 +53,6 @@ test('junit with parallel', function () use ($normalizedPath, $run) {
->assertions->toBe('1')
->errors->toBe('0')
->failures->toBe('0')
->skipped->toBe('0');
expect($result['testsuite']['testcase']['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
->time->toStartWith('0.0');
->skipped->toBe('0')
->and($result['testsuite']['testcase']['@attributes'])->name->toBe('it can pass with comparison')->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))->class->toBe('Tests\tests\SuccessOnly')->classname->toBe('Tests.tests.SuccessOnly')->assertions->toBe('1')->time->toStartWith('0.0');
});
+13 -13
View File
@@ -2,11 +2,11 @@
use Symfony\Component\Process\Process;
$run = function () {
$run = function (): ?string {
$process = new Process(
array_merge(['php', 'bin/pest', '--parallel', '--processes=3'], func_get_args()),
dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
);
$process->run();
@@ -14,9 +14,9 @@ $run = function () {
return removeAnsiEscapeSequences($process->getOutput());
};
test('parallel', function () use ($run) {
test('parallel', function () use ($run): void {
$output = $run('--exclude-group=integration');
$output = implode("\n", array_slice(explode("\n", $output), -10));
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
if (getenv('REBUILD_SNAPSHOTS')) {
preg_match('/Tests:\s+(.+\(\d+ assertions\))/', $output, $matches);
@@ -24,37 +24,37 @@ test('parallel', function () use ($run) {
$file = file_get_contents(__FILE__);
$file = preg_replace(
'/\$expected = \'.*?\';/',
"\$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1435 passed (3156 assertions)';",
"\$expected = '1 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1445 passed (3167 assertions)';",
$file,
);
file_put_contents(__FILE__, $file);
}
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1435 passed (3156 assertions)';
$expected = '1 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 27 skipped, 1445 passed (3167 assertions)';
expect($output)
->toContain("Tests: {$expected}")
->toContain('Parallel: 3 processes');
})->skipOnWindows();
test('a parallel test can extend another test with same name', function () use ($run) {
test('a parallel test can extend another test with same name', function () use ($run): void {
expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 1 passed (1 assertions)');
})->skipOnWindows();
test('parallel reports invalid datasets as failures', function () use ($run) {
test('parallel reports invalid datasets as failures', function () use ($run): void {
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();
test('parallel can have multiple exclude-groups', function () use ($run) {
test('parallel can have multiple exclude-groups', function () use ($run): void {
$singleExclude = $run('--exclude-group=integration');
$doubleExclude = $run('--exclude-group=integration', '--exclude-group=container');
preg_match('/(\d+) passed/', $singleExclude, $singleMatch);
preg_match('/(\d+) passed/', $doubleExclude, $doubleMatch);
preg_match('/(\d+) passed/', (string) $singleExclude, $singleMatch);
preg_match('/(\d+) passed/', (string) $doubleExclude, $doubleMatch);
expect((int) $doubleMatch[1])->toBeLessThan((int) $singleMatch[1]);
expect($doubleExclude)->toContain('Parallel: 3 processes');
expect((int) $doubleMatch[1])->toBeLessThan((int) $singleMatch[1])
->and($doubleExclude)->toContain('Parallel: 3 processes');
})->skipOnWindows();
+2 -2
View File
@@ -16,7 +16,7 @@ $run = function (bool $parallel = false): array {
}
$process = new Process($command, dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
);
$process->run();
@@ -27,7 +27,7 @@ $run = function (bool $parallel = false): array {
];
};
test('parallel loads nested datasets from nested directories', function () use ($run) {
test('parallel loads nested datasets from nested directories', function () use ($run): void {
$serial = $run();
$parallel = $run(true);
+7 -7
View File
@@ -2,9 +2,9 @@
use Symfony\Component\Process\Process;
$run = function (string $target, $decorated = false) {
$run = function (string $target, $decorated = false): ?string {
$process = new Process(['php', 'bin/pest', $target, '--colors=always'], dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
);
$process->run();
@@ -12,7 +12,7 @@ $run = function (string $target, $decorated = false) {
return $decorated ? $process->getOutput() : removeAnsiEscapeSequences($process->getOutput());
};
$snapshot = function ($name) {
$snapshot = function ($name): string|false {
$testsPath = dirname(__DIR__);
return file_get_contents(implode(DIRECTORY_SEPARATOR, [
@@ -22,21 +22,21 @@ $snapshot = function ($name) {
]));
};
test('allows to run a single test', function () use ($run, $snapshot) {
test('allows to run a single test', function () use ($run, $snapshot): void {
expect($run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'))->toContain($snapshot('allows-to-run-a-single-test'));
})->skipOnWindows();
test('allows to run a directory', function () use ($run, $snapshot) {
test('allows to run a directory', function () use ($run, $snapshot): void {
expect($run('tests/Fixtures'))->toContain($snapshot('allows-to-run-a-directory'));
})->skipOnWindows();
it('disable decorating printer when colors is set to never', function () use ($snapshot) {
it('disable decorating printer when colors is set to never', function () use ($snapshot): void {
$process = new Process([
'php',
'./bin/pest',
'--colors=never',
'tests/Fixtures/DirectoryWithTests/ExampleTest.php',
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']);
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']);
$process->run();
$output = $process->getOutput();
expect($output)->toContain($snapshot('disable-decorating-printer'));
+6 -6
View File
@@ -2,7 +2,7 @@
use Symfony\Component\Process\Process;
test('visual snapshot of test suite on success', function () {
test('visual snapshot of test suite on success', function (): void {
$testsPath = dirname(__DIR__);
$snapshot = implode(DIRECTORY_SEPARATOR, [
$testsPath,
@@ -10,11 +10,11 @@ test('visual snapshot of test suite on success', function () {
'success.txt',
]);
$output = function () use ($testsPath) {
$output = function () use ($testsPath): ?string {
$process = (new Process(
['php', '-d', 'memory_limit=256M', 'bin/pest'],
['php', '-d', 'memory_limit=-1', 'bin/pest'],
dirname($testsPath),
['EXCLUDE' => 'integration', '--exclude-group' => 'integration', 'REBUILD_SNAPSHOTS' => false, 'PARATEST' => 0, 'COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['EXCLUDE' => 'integration', '--exclude-group' => 'integration', 'REBUILD_SNAPSHOTS' => false, 'PARATEST' => 0, 'COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
));
$process->run();
@@ -31,14 +31,14 @@ test('visual snapshot of test suite on success', function () {
};
if (getenv('REBUILD_SNAPSHOTS')) {
$outputContent = explode("\n", $output());
$outputContent = explode("\n", (string) $output());
array_pop($outputContent);
array_pop($outputContent);
array_pop($outputContent);
file_put_contents($snapshot, implode("\n", $outputContent));
} elseif (! getenv('EXCLUDE')) {
$output = explode("\n", $output());
$output = explode("\n", (string) $output());
array_pop($output);
array_pop($output);
+3 -2
View File
@@ -9,7 +9,7 @@ function normalize_windows_os_output(string $text): string
return str_replace('\\', '/', $text);
}
test('visual snapshot of team city', function (string $testFile) {
test('visual snapshot of team city', function (string $testFile): void {
$testsPath = dirname(__DIR__)."/.tests/$testFile";
$snapshot = implode(DIRECTORY_SEPARATOR, [
@@ -18,7 +18,7 @@ test('visual snapshot of team city', function (string $testFile) {
"$testFile.inc",
]);
$output = function () use ($testsPath) {
$output = function () use ($testsPath): string {
$process = (new Process(
['php', 'bin/pest', '--teamcity', $testsPath],
dirname(__DIR__, levels: 2),
@@ -28,6 +28,7 @@ test('visual snapshot of team city', function (string $testFile) {
'PARATEST' => 0,
'COLLISION_IGNORE_DURATION' => 'true',
'FLOW_ID' => '1234',
'PAO_DISABLE' => '1',
],
));
+7 -7
View File
@@ -2,9 +2,9 @@
use Symfony\Component\Process\Process;
$run = function (string $target, bool $parallel) {
$run = function (string $target, bool $parallel): ?string {
$process = new Process(['php', 'bin/pest', $target, $parallel ? '--parallel' : ''], dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'],
);
$process->run();
@@ -13,21 +13,21 @@ $run = function (string $target, bool $parallel) {
$output = $process->getOutput();
return preg_replace('/Duration: \d+\.\d+s/', 'Duration: x.xxs', removeAnsiEscapeSequences($output));
return preg_replace('/Duration: \d+\.\d+s/', 'Duration: x.xxs', (string) removeAnsiEscapeSequences($output));
};
test('todos', function () use ($run) {
test('todos', function () use ($run): void {
expect($run('--todos', false))->toMatchSnapshot();
})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));
test('todos in parallel', function () use ($run) {
test('todos in parallel', function () use ($run): void {
expect($run('--todos', true))->toMatchSnapshot();
})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));
test('todo', function () use ($run) {
test('todo', function () use ($run): void {
expect($run('--todo', false))->toMatchSnapshot();
})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));
test('todo in parallel', function () use ($run) {
test('todo in parallel', function () use ($run): void {
expect($run('--todo', true))->toMatchSnapshot();
})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));
+11 -9
View File
@@ -1,37 +1,39 @@
<?php
declare(strict_types=1);
use Symfony\Component\Process\Process;
test('filter works with unicode characters in filename', function () {
test('filter works with unicode characters in filename', function (): void {
$process = new Process([
'php',
'bin/pest',
'tests/.tests/StraßenTest.php',
'--colors=never',
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']);
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']);
$process->run();
$output = $process->getOutput();
expect($output)->toContain('StraßenTest');
expect($output)->toContain('tests unicode filename');
expect($output)->toContain('1 passed');
expect($output)->toContain('StraßenTest')
->toContain('tests unicode filename')
->toContain('1 passed');
})->skipOnWindows();
test('filter with unicode regex matches unicode filename', function () {
test('filter with unicode regex matches unicode filename', function (): void {
$process = new Process([
'php',
'bin/pest',
'--filter=.*Straß.*',
'tests/.tests/',
'--colors=never',
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']);
], dirname(__DIR__, 2), ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']);
$process->run();
$output = $process->getOutput();
expect($output)->toContain('StraßenTest');
expect($output)->toContain('1 passed');
expect($output)->toContain('StraßenTest')
->toContain('1 passed');
})->skipOnWindows();
+3 -3
View File
@@ -2,9 +2,9 @@
use Symfony\Component\Process\Process;
test('visual snapshot of help command output', function () {
$output = function () {
$process = (new Process(['php', 'bin/pest', '--version'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
test('visual snapshot of help command output', function (): void {
$output = function (): ?string {
$process = (new Process(['php', 'bin/pest', '--version'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1']));
$process->run();