annotate vendor/nikic/php-parser/test/PhpParser/ParserFactoryTest.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 4c8ae668cc8c
children 129ea1e6d783
rev   line source
Chris@13 1 <?php declare(strict_types=1);
Chris@0 2
Chris@0 3 namespace PhpParser;
Chris@0 4
Chris@0 5 /* This test is very weak, because PHPUnit's assertEquals assertion is way too slow dealing with the
Chris@0 6 * large objects involved here. So we just do some basic instanceof tests instead. */
Chris@13 7 use PHPUnit\Framework\TestCase;
Chris@13 8
Chris@13 9 class ParserFactoryTest extends TestCase
Chris@13 10 {
Chris@0 11 /** @dataProvider provideTestCreate */
Chris@0 12 public function testCreate($kind, $lexer, $expected) {
Chris@0 13 $this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer));
Chris@0 14 }
Chris@0 15
Chris@0 16 public function provideTestCreate() {
Chris@0 17 $lexer = new Lexer();
Chris@0 18 return [
Chris@0 19 [
Chris@0 20 ParserFactory::PREFER_PHP7, $lexer,
Chris@13 21 Parser\Multiple::class
Chris@0 22 ],
Chris@0 23 [
Chris@0 24 ParserFactory::PREFER_PHP5, null,
Chris@13 25 Parser\Multiple::class
Chris@0 26 ],
Chris@0 27 [
Chris@0 28 ParserFactory::ONLY_PHP7, null,
Chris@13 29 Parser\Php7::class
Chris@0 30 ],
Chris@0 31 [
Chris@0 32 ParserFactory::ONLY_PHP5, $lexer,
Chris@13 33 Parser\Php5::class
Chris@0 34 ]
Chris@0 35 ];
Chris@0 36 }
Chris@13 37 }