Skip to content

Commit

Permalink
feat: update script for latest PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Nov 25, 2020
1 parent 7d32a64 commit e3b0826
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/compile.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
};

$contents = file_get_contents($globalsFilePath);
$contents = $replace($contents, 'namespace PHPUnit\Framework;', 'use PHPUnit\Framework\Assert;');
$contents = $remove($contents, 'use function define;');
$contents = $remove($contents, 'use function defined;');
$contents = $replace($contents, 'namespace PHPUnit\Framework;', <<<'PHP'
if (defined('__PEST_GLOBAL_ASSERT_WRAPPERS__')) {
return;
}
define('__PEST_GLOBAL_ASSERT_WRAPPERS__', true);
use PHPUnit\Framework\Assert;
PHP);
$contents = $remove($contents, 'use function func_get_args;');
$contents = $remove($contents, 'use ArrayAccess;');
$contents = $remove($contents, 'use Countable;');
Expand All @@ -28,7 +33,6 @@
$contents = $remove($contents, 'use Throwable;');

// Fix for order of autoloading files
$contents = $replace($contents, "if (!\\defined('__PHPUNIT_GLOBAL_ASSERT_WRAPPERS__')) {", "if (!\\defined('__PEST_GLOBAL_ASSERT_WRAPPERS__')) {");
$contents = $replace($contents, "\\define('__PHPUNIT_GLOBAL_ASSERT_WRAPPERS__', true);\n}", "\\define('__PEST_GLOBAL_ASSERT_WRAPPERS__', true);\n}");
$contents = $replace($contents, "if (!function_exists('PHPUnit\\Framework\\", "if (!function_exists('");

file_put_contents($compiledFilePath, $contents);

0 comments on commit e3b0826

Please sign in to comment.