mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 02:07:23 +01:00
fix: overrides being used on regular phpunit
This commit is contained in:
40
src/Bootstrappers/BootOverrides.php
Normal file
40
src/Bootstrappers/BootOverrides.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Bootstrappers;
|
||||
|
||||
use Pest\Contracts\Bootstrapper;
|
||||
use Pest\Exceptions\ShouldNotHappen;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BootOverrides implements Bootstrapper
|
||||
{
|
||||
/**
|
||||
* The list of files to be overridden.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const FILES = [
|
||||
'Runner/Filter/NameFilterIterator.php',
|
||||
'Runner/TestSuiteLoader.php',
|
||||
];
|
||||
|
||||
/**
|
||||
* Boots the Subscribers.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
foreach (self::FILES as $file) {
|
||||
$file = __DIR__."/../../overrides/$file";
|
||||
|
||||
if (! file_exists($file)) {
|
||||
throw ShouldNotHappen::fromMessage(sprintf('File [%s] does not exist.', $file));
|
||||
}
|
||||
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user