mirror of
https://github.com/standardebooks/web.git
synced 2025-07-19 04:44:48 -04:00
Add Composer autoloading functions and PHPStan for testing
This commit is contained in:
parent
e198c4db65
commit
f5d7d4e02a
1518 changed files with 169063 additions and 30 deletions
32
vendor/nikic/php-parser/test/updateTests.php
vendored
Normal file
32
vendor/nikic/php-parser/test/updateTests.php
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace PhpParser;
|
||||
|
||||
require __DIR__ . '/bootstrap.php';
|
||||
require __DIR__ . '/PhpParser/CodeTestParser.php';
|
||||
require __DIR__ . '/PhpParser/CodeParsingTest.php';
|
||||
|
||||
$dir = __DIR__ . '/code/parser';
|
||||
|
||||
$testParser = new CodeTestParser;
|
||||
$codeParsingTest = new CodeParsingTest;
|
||||
foreach (filesInDir($dir, 'test') as $fileName => $code) {
|
||||
if (false !== strpos($code, '@@{')) {
|
||||
// Skip tests with evaluate segments
|
||||
continue;
|
||||
}
|
||||
|
||||
list($name, $tests) = $testParser->parseTest($code, 2);
|
||||
$newTests = [];
|
||||
foreach ($tests as list($modeLine, list($input, $expected))) {
|
||||
$modes = null !== $modeLine ? array_fill_keys(explode(',', $modeLine), true) : [];
|
||||
list($parser5, $parser7) = $codeParsingTest->createParsers($modes);
|
||||
list(, $output) = isset($modes['php5'])
|
||||
? $codeParsingTest->getParseOutput($parser5, $input, $modes)
|
||||
: $codeParsingTest->getParseOutput($parser7, $input, $modes);
|
||||
$newTests[] = [$modeLine, [$input, $output]];
|
||||
}
|
||||
|
||||
$newCode = $testParser->reconstructTest($name, $newTests);
|
||||
file_put_contents($fileName, $newCode);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue