Skip to content

Commit 7f45f4a

Browse files
committed
Fix phpunit, add SPC_SKIP_TOOLCHAIN_CHECK
1 parent fcaa7c5 commit 7f45f4a

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
>
55
<php>
66
<env name="SPC_IGNORE_BAD_HASH" value="yes" force="true" />
7+
<env name="SPC_SKIP_TOOLCHAIN_CHECK" value="yes" force="true" />
78
</php>
89
</phpunit>

src/SPC/builder/macos/MacOSBuilder.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public function __construct(array $options = [])
2929

3030
// apply global environment variables
3131
GlobalEnvManager::init();
32-
33-
if (!$this->getOption('no-env-check')) {
34-
GlobalEnvManager::afterInit();
35-
}
32+
GlobalEnvManager::afterInit();
3633

3734
// ---------- set necessary compile vars ----------
3835
// concurrency

src/SPC/command/BaseCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function __construct(?string $name = null)
3232
parent::__construct($name);
3333
$this->addOption('debug', null, null, 'Enable debug mode');
3434
$this->addOption('no-motd', null, null, 'Disable motd');
35-
$this->addOption('no-env-check', null, null, 'Disable env check for builder');
3635
}
3736

3837
public function initialize(InputInterface $input, OutputInterface $output): void
@@ -100,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
10099
// init GlobalEnv
101100
if (!$this instanceof BuildCommand) {
102101
GlobalEnvManager::init();
103-
$this->input->setOption('no-env-check', true);
102+
f_putenv('SPC_SKIP_TOOLCHAIN_CHECK=yes');
104103
}
105104
if ($this->shouldExecute()) {
106105
try {

src/SPC/util/GlobalEnvManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ public static function addPathIfNotExists(string $path): void
108108
*/
109109
public static function afterInit(): void
110110
{
111-
ToolchainManager::afterInitToolchain();
111+
if (!filter_var(getenv('SPC_SKIP_TOOLCHAIN_CHECK'), FILTER_VALIDATE_BOOL)) {
112+
ToolchainManager::afterInitToolchain();
113+
}
112114
}
113115

114116
/**

0 commit comments

Comments
 (0)