Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/updateTests.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
1 <?php | |
2 | |
3 namespace PhpParser; | |
4 | |
5 require __DIR__ . '/bootstrap.php'; | |
6 require __DIR__ . '/PhpParser/CodeTestParser.php'; | |
7 require __DIR__ . '/PhpParser/CodeParsingTest.php'; | |
8 | |
9 $dir = __DIR__ . '/code/parser'; | |
10 | |
11 $testParser = new CodeTestParser; | |
12 $codeParsingTest = new CodeParsingTest; | |
13 foreach (filesInDir($dir, 'test') as $fileName => $code) { | |
14 if (false !== strpos($code, '@@{')) { | |
15 // Skip tests with evaluate segments | |
16 continue; | |
17 } | |
18 | |
19 list($name, $tests) = $testParser->parseTest($code, 2); | |
20 $newTests = []; | |
21 foreach ($tests as list($modeLine, list($input, $expected))) { | |
22 $modes = null !== $modeLine ? array_fill_keys(explode(',', $modeLine), true) : []; | |
23 list($parser5, $parser7) = $codeParsingTest->createParsers($modes); | |
24 $output = isset($modes['php5']) | |
25 ? $codeParsingTest->getParseOutput($parser5, $input, $modes) | |
26 : $codeParsingTest->getParseOutput($parser7, $input, $modes); | |
27 $newTests[] = [$modeLine, [$input, $output]]; | |
28 } | |
29 | |
30 $newCode = $testParser->reconstructTest($name, $newTests); | |
31 file_put_contents($fileName, $newCode); | |
32 } |