Browse Source

Add KnownEnphpBugsException test

master v1.3
Ganlv 3 years ago
parent
commit
ff731f6e01
1 changed files with 23 additions and 2 deletions
  1. +23
    -2
      tests/test.php

+ 23
- 2
tests/test.php View File

@ -9,8 +9,9 @@ $filenames = scandir(SAMPLE_DIR);
$filenames = array_values(array_diff($filenames, ['.', '..']));
foreach ($filenames as $key => $filename) {
echo $filename, PHP_EOL;
$code = file_get_contents(SAMPLE_DIR . '/' . $filename);
$path = SAMPLE_DIR . '/' . $filename;
echo $path, PHP_EOL;
$code = file_get_contents($path);
try {
$code = \Ganlv\EnphpDecoder\AutoDecoder::decode($code);
echo $code, PHP_EOL;
@ -19,3 +20,23 @@ foreach ($filenames as $key => $filename) {
exit(1);
}
}
define('BUG_SAMPLE_DIR', __DIR__ . '/bug_samples');
$filenames = scandir(BUG_SAMPLE_DIR);
$filenames = array_values(array_diff($filenames, ['.', '..']));
foreach ($filenames as $key => $filename) {
$path = BUG_SAMPLE_DIR . '/' . $filename;
echo $path, PHP_EOL;
$code = file_get_contents($path);
try {
$code = \Ganlv\EnphpDecoder\AutoDecoder::decode($code);
echo $code, PHP_EOL;
exit(3);
} catch (\Ganlv\EnphpDecoder\KnownEnphpBugs\KnownEnphpBugsException $e) {
echo 'KnownEnphpBugsException: ', $e->getMessage(), PHP_EOL;
} catch (Exception $e) {
echo $e->getTraceAsString();
exit(2);
}
}

Loading…
Cancel
Save