mirror of
https://github.com/pestphp/pest.git
synced 2026-12-06 15:52:16 +01:00
fix(tia): answer the stream_lock support probe (#2029)
* fix(tia): answer the stream_lock support probe * Refresh stream lock regression snapshots * Correct scoped callback typing and PHPStan compatibility --------- Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
"pestphp/pest-plugin-phpstan": "^5.3.1",
|
||||
"pestphp/pest-plugin-rector": "^5.0.6",
|
||||
"pestphp/pest-plugin-type-coverage": "^5.1.0",
|
||||
"phpstan/phpstan": "^2.3.4 <2.3.6",
|
||||
"psy/psysh": "^0.12.24"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
|
||||
@@ -71,7 +71,7 @@ final class HigherOrderExpectation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Closure(Expectation<TValue>): void $expectation
|
||||
* @param Closure(Expectation<TValue>|EachExpectation<TValue>): void $expectation
|
||||
* @return HigherOrderExpectation<TOriginalValue, TOriginalValue>
|
||||
*/
|
||||
public function scoped(Closure $expectation): self
|
||||
|
||||
@@ -197,6 +197,10 @@ final class ReadCapture
|
||||
*/
|
||||
public function stream_lock(int $operation): bool
|
||||
{
|
||||
if (($operation & ~LOCK_NB) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->forward('stream_lock', fn (mixed $resource): bool => flock($resource, $operation), $operation) === true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2037,6 +2037,7 @@
|
||||
✓ the file wrapper → it is replaced while a test records and restored after it
|
||||
✓ the file wrapper → it is restored when the recorder resets
|
||||
✓ the file wrapper → it passes filesystem operations through while a test records
|
||||
✓ the file wrapper → it writes with LOCK_EX while a test records
|
||||
✓ the file wrapper → it reports symlinks as links while a test records with dataset "a link to an existing file"
|
||||
✓ the file wrapper → it reports symlinks as links while a test records with dataset "a dangling link"
|
||||
✓ a wrapper already registered for file:// → it opens reads through it and still links them
|
||||
@@ -2388,4 +2389,4 @@
|
||||
✓ pass with dataset with ('my-datas-set-value')
|
||||
✓ within describe → pass with dataset with ('my-datas-set-value')
|
||||
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 37 skipped, 1703 passed (3758 assertions)
|
||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 37 skipped, 1704 passed (3760 assertions)
|
||||
@@ -187,6 +187,21 @@ describe('the file wrapper', function (): void {
|
||||
]);
|
||||
});
|
||||
|
||||
it('writes with LOCK_EX while a test records', function (): void {
|
||||
$path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'pest-read-capture-lock-'.bin2hex(random_bytes(8));
|
||||
|
||||
try {
|
||||
tiaReadCaptureLinks(function () use ($path, &$written): void {
|
||||
$written = file_put_contents($path, 'locked', LOCK_EX);
|
||||
});
|
||||
|
||||
expect($written)->toBe(6)
|
||||
->and(file_get_contents($path))->toBe('locked');
|
||||
} finally {
|
||||
@unlink($path);
|
||||
}
|
||||
});
|
||||
|
||||
it('reports symlinks as links while a test records', function (bool $targetExists, bool $expectedExists): void {
|
||||
$directory = sys_get_temp_dir().DIRECTORY_SEPARATOR.'pest-read-capture-'.bin2hex(random_bytes(8));
|
||||
mkdir($directory);
|
||||
|
||||
@@ -21,7 +21,7 @@ test('parallel', function () use ($run): void {
|
||||
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
|
||||
$profileOutput = $run('tests/Fixtures/Suites/SuccessOnly.php', '--profile');
|
||||
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 29 skipped, 1674 passed (3680 assertions)';
|
||||
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 29 skipped, 1675 passed (3682 assertions)';
|
||||
|
||||
expect($output)
|
||||
->toContain("Tests: {$expected}")
|
||||
|
||||
Reference in New Issue
Block a user