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