updates dependencies and snapshots

This commit is contained in:
Nuno Maduro
2025-07-22 23:51:32 +01:00
parent 21e22decf3
commit f9901245f1
10 changed files with 31 additions and 26 deletions

View File

@ -18,19 +18,19 @@
], ],
"require": { "require": {
"php": "^8.3.0", "php": "^8.3.0",
"brianium/paratest": "^7.10.3", "brianium/paratest": "^7.11.0",
"nunomaduro/collision": "^8.8.2", "nunomaduro/collision": "^8.8.2",
"nunomaduro/termwind": "^2.3.1", "nunomaduro/termwind": "^2.3.1",
"pestphp/pest-plugin": "^4.0.0", "pestphp/pest-plugin": "^4.0.0",
"pestphp/pest-plugin-arch": "^4.0.0", "pestphp/pest-plugin-arch": "^4.0.0",
"pestphp/pest-plugin-mutate": "^4.0.0", "pestphp/pest-plugin-mutate": "^4.0.0",
"pestphp/pest-plugin-profanity": "^4.0.0", "pestphp/pest-plugin-profanity": "^4.0.0",
"phpunit/phpunit": "^12.2.6", "phpunit/phpunit": "^12.2.7",
"symfony/process": "^7.3.0" "symfony/process": "^7.3.0"
}, },
"conflict": { "conflict": {
"filp/whoops": "<2.18.3", "filp/whoops": "<2.18.3",
"phpunit/phpunit": ">12.2.6", "phpunit/phpunit": ">12.2.7",
"sebastian/exporter": "<7.0.0", "sebastian/exporter": "<7.0.0",
"webmozart/assert": "<1.11.0" "webmozart/assert": "<1.11.0"
}, },

View File

@ -49,7 +49,7 @@ use const DIRECTORY_SEPARATOR;
use const LOCK_EX; use const LOCK_EX;
use PHPUnit\Framework\TestStatus\TestStatus; use PHPUnit\Framework\TestStatus\TestStatus;
use PHPUnit\Runner\DirectoryCannotBeCreatedException; use PHPUnit\Runner\DirectoryDoesNotExistException;
use PHPUnit\Runner\Exception; use PHPUnit\Runner\Exception;
use PHPUnit\Util\Filesystem; use PHPUnit\Util\Filesystem;
@ -72,10 +72,7 @@ use function Pest\version;
*/ */
final class DefaultResultCache implements ResultCache final class DefaultResultCache implements ResultCache
{ {
/** private const string DEFAULT_RESULT_CACHE_FILENAME = '.phpunit.result.cache';
* @var string
*/
private const DEFAULT_RESULT_CACHE_FILENAME = '.phpunit.result.cache';
private readonly string $cacheFilename; private readonly string $cacheFilename;
@ -98,28 +95,28 @@ final class DefaultResultCache implements ResultCache
$this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME; $this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME;
} }
public function setStatus(string $id, TestStatus $status): void public function setStatus(ResultCacheId $id, TestStatus $status): void
{ {
if ($status->isSuccess()) { if ($status->isSuccess()) {
return; return;
} }
$this->defects[$id] = $status; $this->defects[$id->asString()] = $status;
} }
public function status(string $id): TestStatus public function status(ResultCacheId $id): TestStatus
{ {
return $this->defects[$id] ?? TestStatus::unknown(); return $this->defects[$id->asString()] ?? TestStatus::unknown();
} }
public function setTime(string $id, float $time): void public function setTime(ResultCacheId $id, float $time): void
{ {
$this->times[$id] = $time; $this->times[$id->asString()] = $time;
} }
public function time(string $id): float public function time(ResultCacheId $id): float
{ {
return $this->times[$id] ?? 0.0; return $this->times[$id->asString()] ?? 0.0;
} }
public function mergeWith(self $other): void public function mergeWith(self $other): void
@ -179,7 +176,7 @@ final class DefaultResultCache implements ResultCache
public function persist(): void public function persist(): void
{ {
if (! Filesystem::createDirectory(dirname($this->cacheFilename))) { if (! Filesystem::createDirectory(dirname($this->cacheFilename))) {
throw new DirectoryCannotBeCreatedException($this->cacheFilename); throw new DirectoryDoesNotExistException(dirname($this->cacheFilename));
} }
$data = [ $data = [

View File

@ -660,7 +660,7 @@ final class Expectation
{ {
foreach ($keys as $k => $key) { foreach ($keys as $k => $key) {
if (is_array($key)) { if (is_array($key)) {
$this->toHaveKeys(array_keys(Arr::dot($key, $k . '.')), $message); $this->toHaveKeys(array_keys(Arr::dot($key, $k.'.')), $message);
} else { } else {
$this->toHaveKey($key, message: $message); $this->toHaveKey($key, message: $message);
} }

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '4.0.0-alpha.5'; return '4.0.0-alpha.6';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -19,8 +19,8 @@ final class SnapshotRepository
* Creates a snapshot repository instance. * Creates a snapshot repository instance.
*/ */
public function __construct( public function __construct(
readonly private string $testsPath, private readonly string $testsPath,
readonly private string $snapshotsPath, private readonly string $snapshotsPath,
) {} ) {}
/** /**

View File

@ -58,7 +58,7 @@ final class Str
{ {
$code = str_replace('_', '__', $code); $code = str_replace('_', '__', $code);
$code = self::PREFIX . str_replace(' ', '_', $code); $code = self::PREFIX.str_replace(' ', '_', $code);
// sticks to PHP8.2 function naming rules https://www.php.net/manual/en/functions.user-defined.php // sticks to PHP8.2 function naming rules https://www.php.net/manual/en/functions.user-defined.php
return (string) preg_replace('/[^a-zA-Z0-9_\x80-\xff]/', '_', $code); return (string) preg_replace('/[^a-zA-Z0-9_\x80-\xff]/', '_', $code);
@ -124,6 +124,7 @@ final class Str
public static function slugify(string $target): string public static function slugify(string $target): string
{ {
$target = preg_replace('/[^a-zA-Z0-9]+/', '-', $target); $target = preg_replace('/[^a-zA-Z0-9]+/', '-', $target);
return strtolower(trim($target, '-')); return strtolower(trim($target, '-'));
} }
} }

View File

@ -1,5 +1,5 @@
Pest Testing Framework 4.0.0-alpha.5. Pest Testing Framework 4.0.0-alpha.6.
USAGE: pest <file> [options] USAGE: pest <file> [options]

View File

@ -1,3 +1,3 @@
Pest Testing Framework 4.0.0-alpha.5. Pest Testing Framework 4.0.0-alpha.6.

View File

@ -628,6 +628,13 @@
✓ pass ✓ pass
✓ failures ✓ failures
✓ failures with custom message ✓ failures with custom message
✓ not failures
PASS Tests\Features\Expect\toBeSlug
✓ pass
✓ failures
✓ failures with custom message
✓ failures with default message
✓ not failures ✓ not failures
PASS Tests\Features\Expect\toBeSnakeCase PASS Tests\Features\Expect\toBeSnakeCase
@ -1719,4 +1726,4 @@
WARN Tests\Visual\Version WARN Tests\Visual\Version
- visual snapshot of help command output - visual snapshot of help command output
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 33 skipped, 1149 passed (2742 assertions) Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 33 skipped, 1154 passed (2754 assertions)

View File

@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) { test('parallel', function () use ($run) {
expect($run('--exclude-group=integration')) expect($run('--exclude-group=integration'))
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 24 skipped, 1139 passed (2718 assertions)') ->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 38 todos, 24 skipped, 1144 passed (2730 assertions)')
->toContain('Parallel: 3 processes'); ->toContain('Parallel: 3 processes');
})->skipOnWindows(); })->skipOnWindows();