PHPUnit 10 (#117)

This commit is contained in:
Alexander M. Turek
2024-02-05 12:56:58 +01:00
committed by GitHub
parent 9a3516d5a1
commit 31ad66abc0
5 changed files with 27 additions and 35 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
/vendor
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.phpunit.cache
/phpcs.xml
/.phpcs-cache

View File

@@ -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"
},

View File

@@ -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>

View File

@@ -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 -->

View File

@@ -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 {