diff --git a/.php_cs b/.php_cs index f6b713a..1c408b6 100644 --- a/.php_cs +++ b/.php_cs @@ -325,5 +325,6 @@ return PhpCsFixer\Config::create() ->exclude('vendor') ->in(__DIR__) ->name('.php_cs') + ->append(glob(__DIR__ . '/scripts/tests/*')) ) ; diff --git a/scripts/check-installed-extension.php b/scripts/check-installed-extension.php index 96e3444..9af280c 100644 --- a/scripts/check-installed-extension.php +++ b/scripts/check-installed-extension.php @@ -9,7 +9,10 @@ $nameMap = [ $testsDir = __DIR__ . '/tests'; function runTest($testFile) { - return include $testFile; + $rc = -1; + passthru($testFile, $rc); + + return $rc === 0; } for ($index = 1, $count = isset($argv) ? count($argv) : 0; $index < $count; $index++) { @@ -26,7 +29,7 @@ for ($index = 1, $count = isset($argv) ? count($argv) : 0; $index < $count; $ind if (!extension_loaded($extension)) { fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension)); } else { - $testFile = "{$testsDir}/{$extension}.php"; + $testFile = "{$testsDir}/{$extension}"; if (is_file($testFile)) { try { if (runTest($testFile) === true) { diff --git a/scripts/tests/gd.php b/scripts/tests/gd old mode 100644 new mode 100755 similarity index 71% rename from scripts/tests/gd.php rename to scripts/tests/gd index e9406a0..16d2d54 --- a/scripts/tests/gd.php +++ b/scripts/tests/gd @@ -1,5 +1,21 @@ +#!/usr/bin/env php getMessage()); +} catch (Throwable $x) { + $rc = 1; + fwrite(STDERR, $x->getMessage()); } finally { imagedestroy($image); if (is_resource($image2)) { @@ -69,12 +98,4 @@ try { unlink($tempFile); } } - -if (!function_exists('imagefttext')) { - throw new Exception('imagefttext() function is missing'); -} -if (!function_exists('imageantialias')) { - throw new Exception('imageantialias() function is missing'); -} - -return true; +exit($rc);