Fix phpunit, add SPC_SKIP_TOOLCHAIN_CHECK

This commit is contained in:
crazywhalecc 2025-06-29 19:48:09 +08:00
parent fcaa7c5f42
commit 7f45f4aeec
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
4 changed files with 6 additions and 7 deletions

View File

@ -4,5 +4,6 @@
> >
<php> <php>
<env name="SPC_IGNORE_BAD_HASH" value="yes" force="true" /> <env name="SPC_IGNORE_BAD_HASH" value="yes" force="true" />
<env name="SPC_SKIP_TOOLCHAIN_CHECK" value="yes" force="true" />
</php> </php>
</phpunit> </phpunit>

View File

@ -29,10 +29,7 @@ class MacOSBuilder extends UnixBuilderBase
// apply global environment variables // apply global environment variables
GlobalEnvManager::init(); GlobalEnvManager::init();
if (!$this->getOption('no-env-check')) {
GlobalEnvManager::afterInit(); GlobalEnvManager::afterInit();
}
// ---------- set necessary compile vars ---------- // ---------- set necessary compile vars ----------
// concurrency // concurrency

View File

@ -32,7 +32,6 @@ abstract class BaseCommand extends Command
parent::__construct($name); parent::__construct($name);
$this->addOption('debug', null, null, 'Enable debug mode'); $this->addOption('debug', null, null, 'Enable debug mode');
$this->addOption('no-motd', null, null, 'Disable motd'); $this->addOption('no-motd', null, null, 'Disable motd');
$this->addOption('no-env-check', null, null, 'Disable env check for builder');
} }
public function initialize(InputInterface $input, OutputInterface $output): void public function initialize(InputInterface $input, OutputInterface $output): void
@ -100,7 +99,7 @@ abstract class BaseCommand extends Command
// init GlobalEnv // init GlobalEnv
if (!$this instanceof BuildCommand) { if (!$this instanceof BuildCommand) {
GlobalEnvManager::init(); GlobalEnvManager::init();
$this->input->setOption('no-env-check', true); f_putenv('SPC_SKIP_TOOLCHAIN_CHECK=yes');
} }
if ($this->shouldExecute()) { if ($this->shouldExecute()) {
try { try {

View File

@ -108,8 +108,10 @@ class GlobalEnvManager
*/ */
public static function afterInit(): void public static function afterInit(): void
{ {
if (!filter_var(getenv('SPC_SKIP_TOOLCHAIN_CHECK'), FILTER_VALIDATE_BOOL)) {
ToolchainManager::afterInitToolchain(); ToolchainManager::afterInitToolchain();
} }
}
/** /**
* @throws WrongUsageException * @throws WrongUsageException