19 行
602 B
PHP
19 行
602 B
PHP
<?php
|
|
$path = getenv('MEDIA_NORMALIZER_PATH');
|
|
if (!is_file($path)) { fwrite(STDERR, "FAIL: finish image normalizer is missing\n"); exit(1); }
|
|
require $path;
|
|
use app\common\library\FinishImageUrls;
|
|
$a = 'https://example.test/one.jpg';
|
|
$b = 'https://example.test/two.jpg';
|
|
$cases = [
|
|
[[$a . ',' . $b], [$a, $b]],
|
|
[[$a, $b], [$a, $b]],
|
|
[[$a], [$a]],
|
|
[[], []],
|
|
];
|
|
foreach ($cases as $case) {
|
|
$actual = FinishImageUrls::normalize($case[0]);
|
|
if ($actual !== $case[1]) { fwrite(STDERR, "FAIL: " . json_encode($actual) . "\n"); exit(1); }
|
|
}
|
|
echo "finish image normalization passed\n";
|