mirror of
https://github.com/doctrine/lexer.git
synced 2026-03-23 22:22:11 +01:00
PHPUnit 10 (#117)
This commit is contained in:
committed by
GitHub
parent
9a3516d5a1
commit
31ad66abc0
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,6 @@
|
||||
/vendor
|
||||
/composer.lock
|
||||
/phpunit.xml
|
||||
/.phpunit.result.cache
|
||||
/.phpunit.cache
|
||||
/phpcs.xml
|
||||
/.phpcs-cache
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^12",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"psalm/plugin-phpunit": "^0.18.3",
|
||||
"vimeo/psalm": "^5.21"
|
||||
},
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
convertNoticesToExceptions="true"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<ini name="error_reporting" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
@@ -18,9 +18,9 @@
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
<file name="src/Token.php" />
|
||||
</errorLevel>
|
||||
</MixedReturnStatement>
|
||||
<PossiblyUnusedMethod>
|
||||
<errorLevel type="suppress">
|
||||
<!-- https://github.com/psalm/psalm-plugin-phpunit/issues/131 -->
|
||||
<file name="tests/AbstractLexerTest.php" />
|
||||
</errorLevel>
|
||||
</PossiblyUnusedMethod>
|
||||
<PossiblyUnusedProperty>
|
||||
<errorLevel type="suppress">
|
||||
<!-- TODO: Cover this property in a test -->
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Doctrine\Tests\Common\Lexer;
|
||||
|
||||
use Doctrine\Common\Lexer\Token;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function array_map;
|
||||
@@ -82,11 +83,8 @@ class AbstractLexerTest extends TestCase
|
||||
$this->assertEquals($expectedTokens[0], $this->concreteLexer->lookahead);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<Token<string, string|int>> $expectedTokens
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testMoveNext(string $input, array $expectedTokens): void
|
||||
{
|
||||
$this->concreteLexer->setInput($input);
|
||||
@@ -126,11 +124,8 @@ class AbstractLexerTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<Token<string, string|int>> $expectedTokens
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testPeek(string $input, array $expectedTokens): void
|
||||
{
|
||||
$this->concreteLexer->setInput($input);
|
||||
@@ -146,11 +141,8 @@ class AbstractLexerTest extends TestCase
|
||||
$this->assertNull($this->concreteLexer->peek());
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<Token<string, string|int>> $expectedTokens
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testGlimpse(string $input, array $expectedTokens): void
|
||||
{
|
||||
$this->concreteLexer->setInput($input);
|
||||
@@ -177,7 +169,7 @@ class AbstractLexerTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/** @dataProvider inputUntilPositionDataProvider */
|
||||
#[DataProvider('inputUntilPositionDataProvider')]
|
||||
public function testGetInputUntilPosition(
|
||||
string $input,
|
||||
int $position,
|
||||
@@ -188,11 +180,8 @@ class AbstractLexerTest extends TestCase
|
||||
$this->assertSame($expectedInput, $this->concreteLexer->getInputUntilPosition($position));
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<Token<string, string|int>> $expectedTokens
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testIsNextToken(string $input, array $expectedTokens): void
|
||||
{
|
||||
$this->concreteLexer->setInput($input);
|
||||
@@ -205,11 +194,8 @@ class AbstractLexerTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param list<Token<string, string|int>> $expectedTokens
|
||||
*
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testIsNextTokenAny(string $input, array $expectedTokens): void
|
||||
{
|
||||
$allTokenTypes = array_map(static function ($token): string {
|
||||
|
||||
Reference in New Issue
Block a user