mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 23:28:15 +01:00
a5033e3860
The unnecessary parentheses for "new" are a bit annoying, but I can live with it...
28 lines
839 B
PHP
28 lines
839 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace PhpParser;
|
|
|
|
/* This test is very weak, because PHPUnit's assertEquals assertion is way too slow dealing with the
|
|
* large objects involved here. So we just do some basic instanceof tests instead. */
|
|
|
|
class ParserFactoryTest extends \PHPUnit\Framework\TestCase {
|
|
/** @dataProvider provideTestCreate */
|
|
public function testCreate($kind, $lexer, $expected) {
|
|
$this->assertInstanceOf($expected, (new ParserFactory())->create($kind, $lexer));
|
|
}
|
|
|
|
public function provideTestCreate() {
|
|
$lexer = new Lexer();
|
|
return [
|
|
[
|
|
ParserFactory::PREFER_PHP7, $lexer,
|
|
Parser\Php7::class
|
|
],
|
|
[
|
|
ParserFactory::ONLY_PHP7, null,
|
|
Parser\Php7::class
|
|
],
|
|
];
|
|
}
|
|
}
|