Merge pull request #175 from mlocati/extension-tests-any-language
Don't force PHP as the langauge of extension testspull/177/head
commit
703a613e86
1
.php_cs
1
.php_cs
|
@ -325,5 +325,6 @@ return PhpCsFixer\Config::create()
|
|||
->exclude('vendor')
|
||||
->in(__DIR__)
|
||||
->name('.php_cs')
|
||||
->append(glob(__DIR__ . '/scripts/tests/*'))
|
||||
)
|
||||
;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
set_error_handler(
|
||||
static function ($errno, $errstr, $errfile, $errline) {
|
||||
$msg = "Error {$errno}: {$errstr}\n";
|
||||
if ($errfile) {
|
||||
$msg .= "File: {$errfile}\n";
|
||||
if ($errline) {
|
||||
$msg .= "Line: {$errline}\n";
|
||||
}
|
||||
}
|
||||
fwrite(STDERR, $msg);
|
||||
exit(1);
|
||||
},
|
||||
-1
|
||||
);
|
||||
|
||||
$imageWidth = 8;
|
||||
$imageHeight = 16;
|
||||
$image = imagecreatetruecolor($imageWidth, $imageHeight);
|
||||
|
@ -60,6 +76,19 @@ try {
|
|||
}
|
||||
imagedestroy($image2);
|
||||
}
|
||||
if (!function_exists('imagefttext')) {
|
||||
throw new Exception('imagefttext() function is missing');
|
||||
}
|
||||
if (!function_exists('imageantialias')) {
|
||||
throw new Exception('imageantialias() function is missing');
|
||||
}
|
||||
$rc = 0;
|
||||
} catch (Exception $x) {
|
||||
$rc = 1;
|
||||
fwrite(STDERR, $x->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);
|
Loading…
Reference in New Issue