PHP-Parser/test/PhpParser/ParserFactoryTest.php
Nikita Popov a5033e3860 Format tests as well
The unnecessary parentheses for "new" are a bit annoying, but I
can live with it...
2022-08-29 21:52:53 +02:00

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
],
];
}
}