annotate vendor/nikic/php-parser/test/PhpParser/ParserFactoryTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author |
Chris Cannam |
date |
Thu, 28 Feb 2019 13:21:36 +0000 |
parents |
5fb285c0d0e3 |
children |
|
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
|
Chris@17
|
8 class ParserFactoryTest extends \PHPUnit\Framework\TestCase
|
Chris@13
|
9 {
|
Chris@0
|
10 /** @dataProvider provideTestCreate */
|
Chris@0
|
11 public function testCreate($kind, $lexer, $expected) {
|
Chris@0
|
12 $this->assertInstanceOf($expected, (new ParserFactory)->create($kind, $lexer));
|
Chris@0
|
13 }
|
Chris@0
|
14
|
Chris@0
|
15 public function provideTestCreate() {
|
Chris@0
|
16 $lexer = new Lexer();
|
Chris@0
|
17 return [
|
Chris@0
|
18 [
|
Chris@0
|
19 ParserFactory::PREFER_PHP7, $lexer,
|
Chris@13
|
20 Parser\Multiple::class
|
Chris@0
|
21 ],
|
Chris@0
|
22 [
|
Chris@0
|
23 ParserFactory::PREFER_PHP5, null,
|
Chris@13
|
24 Parser\Multiple::class
|
Chris@0
|
25 ],
|
Chris@0
|
26 [
|
Chris@0
|
27 ParserFactory::ONLY_PHP7, null,
|
Chris@13
|
28 Parser\Php7::class
|
Chris@0
|
29 ],
|
Chris@0
|
30 [
|
Chris@0
|
31 ParserFactory::ONLY_PHP5, $lexer,
|
Chris@13
|
32 Parser\Php5::class
|
Chris@0
|
33 ]
|
Chris@0
|
34 ];
|
Chris@0
|
35 }
|
Chris@13
|
36 }
|