Mercurial > hg > isophonics-drupal-site
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/nikic/php-parser/test/updateTests.php Mon Apr 23 09:33:26 2018 +0100 @@ -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); + $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); +}