feat: only registers globals if necessary

This commit is contained in:
Nuno Maduro
2022-12-04 16:32:45 +00:00
parent 7ffc5602b4
commit 3324455e0a
2 changed files with 145 additions and 141 deletions

View File

@ -11,6 +11,8 @@ use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
(static function () {
$_SERVER['__PEST__'] = true;
// Ensures Collision's Printer is registered.
$_SERVER['COLLISION_PRINTER'] = 'DefaultPrinter';

View File

@ -14,6 +14,7 @@ use Pest\Support\HigherOrderTapProxy;
use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
if (array_key_exists('__PEST__', $_SERVER)) {
if (! function_exists('expect')) {
/**
* Creates a new expectation.
@ -160,3 +161,4 @@ if (! function_exists('afterAll')) {
TestSuite::getInstance()->afterAll->set($closure);
}
}
}