diff --git a/src/SPC/builder/traits/UnixBuilderTrait.php b/src/SPC/builder/traits/UnixBuilderTrait.php index 8dafe20a3..5ca62f1bd 100644 --- a/src/SPC/builder/traits/UnixBuilderTrait.php +++ b/src/SPC/builder/traits/UnixBuilderTrait.php @@ -66,14 +66,23 @@ public function sanityCheck(int $build_target): void if ($ret !== 0 || trim(implode('', $output)) !== 'hello') { throw new RuntimeException('cli failed sanity check'); } + foreach ($this->exts as $ext) { logger()->debug('testing ext: ' . $ext->getName()); [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "' . $ext->getDistName() . '"', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $ext->getName() . ' failed compile check'); } + if (file_exists(ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php')) { - [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php ' . ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php'); + // Trim additional content & escape special characters to allow inline usage + $test = str_replace( + ['getName() . '.php') + ); + + [$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "' . trim($test) . '"'); if ($ret !== 0) { throw new RuntimeException('extension ' . $ext->getName() . ' failed sanity check'); } diff --git a/src/globals/tests/dom.php b/src/globals/tests/dom.php index f1f28d122..65e3617f2 100644 --- a/src/globals/tests/dom.php +++ b/src/globals/tests/dom.php @@ -4,5 +4,5 @@ assert(class_exists('\\DOMDocument')); $doc = new DOMDocument(); -$doc->loadHtml("Hello"); +$doc->loadHtml('Hello'); assert($doc->getElementById('app')->nodeValue === 'Hello');