mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
chore: fixes test suite
This commit is contained in:
@ -125,8 +125,14 @@ final class DefaultResultCache implements ResultCache
|
||||
return;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($this->cacheFilename);
|
||||
|
||||
if ($contents === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode(
|
||||
file_get_contents($this->cacheFilename),
|
||||
$contents,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
@ -59,46 +58,40 @@ use function array_map;
|
||||
*/
|
||||
final readonly class TestSuiteFilterProcessor
|
||||
{
|
||||
private Factory $filterFactory;
|
||||
|
||||
public function __construct(Factory $factory = new Factory)
|
||||
{
|
||||
$this->filterFactory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Event\RuntimeException
|
||||
* @throws FilterNotConfiguredException
|
||||
*/
|
||||
public function process(Configuration $configuration, TestSuite $suite): void
|
||||
{
|
||||
$factory = new Factory;
|
||||
|
||||
if (! $configuration->hasFilter() &&
|
||||
! $configuration->hasGroups() &&
|
||||
! $configuration->hasExcludeGroups() &&
|
||||
! $configuration->hasExcludeFilter() &&
|
||||
! $configuration->hasTestsCovering() &&
|
||||
! $configuration->hasTestsUsing() &&
|
||||
! Only::isEnabled()
|
||||
) {
|
||||
! Only::isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($configuration->hasExcludeGroups()) {
|
||||
$this->filterFactory->addExcludeGroupFilter(
|
||||
$factory->addExcludeGroupFilter(
|
||||
$configuration->excludeGroups(),
|
||||
);
|
||||
}
|
||||
|
||||
if (Only::isEnabled()) {
|
||||
$this->filterFactory->addIncludeGroupFilter(['__pest_only']);
|
||||
$factory->addIncludeGroupFilter(['__pest_only']);
|
||||
} elseif ($configuration->hasGroups()) {
|
||||
$this->filterFactory->addIncludeGroupFilter(
|
||||
$factory->addIncludeGroupFilter(
|
||||
$configuration->groups(),
|
||||
);
|
||||
}
|
||||
|
||||
if ($configuration->hasTestsCovering()) {
|
||||
$this->filterFactory->addIncludeGroupFilter(
|
||||
$factory->addIncludeGroupFilter(
|
||||
array_map(
|
||||
static fn (string $name): string => '__phpunit_covers_'.$name,
|
||||
$configuration->testsCovering(),
|
||||
@ -107,7 +100,7 @@ final readonly class TestSuiteFilterProcessor
|
||||
}
|
||||
|
||||
if ($configuration->hasTestsUsing()) {
|
||||
$this->filterFactory->addIncludeGroupFilter(
|
||||
$factory->addIncludeGroupFilter(
|
||||
array_map(
|
||||
static fn (string $name): string => '__phpunit_uses_'.$name,
|
||||
$configuration->testsUsing(),
|
||||
@ -116,18 +109,18 @@ final readonly class TestSuiteFilterProcessor
|
||||
}
|
||||
|
||||
if ($configuration->hasExcludeFilter()) {
|
||||
$this->filterFactory->addExcludeNameFilter(
|
||||
$factory->addExcludeNameFilter(
|
||||
$configuration->excludeFilter(),
|
||||
);
|
||||
}
|
||||
|
||||
if ($configuration->hasFilter()) {
|
||||
$this->filterFactory->addIncludeNameFilter(
|
||||
$factory->addIncludeNameFilter(
|
||||
$configuration->filter(),
|
||||
);
|
||||
}
|
||||
|
||||
$suite->injectFilter($this->filterFactory);
|
||||
$suite->injectFilter($factory);
|
||||
|
||||
Event\Facade::emitter()->testSuiteFiltered(
|
||||
Event\TestSuite\TestSuiteBuilder::from($suite),
|
||||
|
||||
@ -18,12 +18,12 @@ final class BootOverrides implements Bootstrapper
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const FILES = [
|
||||
'ec723a9efae521dd6576d2e7d746cc12d3e27f271c49c46420fba8a0e161a61f' => 'Runner/Filter/NameFilterIterator.php',
|
||||
'52b2574e96269aca1bb2d41bbf418c3bcf23dd21d14c66f90789025c309e39df' => 'Runner/ResultCache/DefaultResultCache.php',
|
||||
'4f57b79c6ca77cab241cef879ea98bc743d2cd1fbe4586ab652608bf29aa4176' => 'Runner/Filter/NameFilterIterator.php',
|
||||
'c7c09ab7c9378710b27f761a4b2948196cbbdf2a73e4389bcdca1e7c94fa9c21' => 'Runner/ResultCache/DefaultResultCache.php',
|
||||
'bc8718c89264f65800beabc23e51c6d3bcff87dfc764a12179ef5dbfde272c8b' => 'Runner/TestSuiteLoader.php',
|
||||
'2ef8e21dbb27cf6597dd9bb0f941c063dcc98b5af2c35d10b1c2d77721582e8f' => 'TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php',
|
||||
'badc88c79c2a47d768be3925051999b158d08b64e57ccf4ce560f1610cbcc1e8' => 'TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php',
|
||||
'8607a62825a762735721c39e5d7d59f6efee1409d85cd3b1a976d0d83a308be0' => 'TextUI/TestSuiteFilterProcessor.php',
|
||||
'5ff38e143e244c4d80e767447e5a045891cc6518f008f24f2bb945289b83a07f' => 'TextUI/TestSuiteFilterProcessor.php',
|
||||
'a01a02eadd18146f12731c7adb8cd56cf76f3f6bda2bae06ff4fd6573789b0f4' => 'Event/Value/ThrowableBuilder.php',
|
||||
'c78f96e34b98ed01dd8106539d59b8aa8d67f733274118b827c01c5c4111c033' => 'Logging/JUnit/JunitXmlLogger.php',
|
||||
];
|
||||
|
||||
@ -5,8 +5,7 @@ declare(strict_types=1);
|
||||
use Pest\Bootstrappers\BootOverrides;
|
||||
|
||||
test('versions', function (string $vendorPath, string $expectedHash) {
|
||||
// expect(hash_file('sha256', $vendorPath))->toBe($expectedHash);
|
||||
expect(true)->toBeTrue();
|
||||
expect(hash_file('sha256', $vendorPath))->toBe($expectedHash);
|
||||
})->with(function () {
|
||||
foreach (BootOverrides::FILES as $hash => $file) {
|
||||
$path = implode(DIRECTORY_SEPARATOR, [
|
||||
|
||||
Reference in New Issue
Block a user