Skip to content

Commit

Permalink
PHPUnit 10 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Feb 5, 2024
1 parent 9a3516d commit 31ad66a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,6 @@
/vendor
/composer.lock
/phpunit.xml
/.phpunit.result.cache
/.phpunit.cache
/phpcs.xml
/.phpcs-cache
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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"
},
Expand Down
14 changes: 7 additions & 7 deletions phpunit.xml.dist
Expand Up @@ -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>
Expand All @@ -18,9 +18,9 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<source>
<include>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
6 changes: 6 additions & 0 deletions psalm.xml
Expand Up @@ -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 -->
Expand Down
38 changes: 12 additions & 26 deletions tests/AbstractLexerTest.php
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Common\Lexer;

use Doctrine\Common\Lexer\Token;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

use function array_map;
Expand Down Expand Up @@ -82,11 +83,8 @@ public function testResetPosition(): void
$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);
Expand Down Expand Up @@ -126,11 +124,8 @@ public function testUtf8Mismatch(): void
);
}

/**
* @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);
Expand All @@ -146,11 +141,8 @@ public function testPeek(string $input, array $expectedTokens): void
$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);
Expand All @@ -177,7 +169,7 @@ public static function inputUntilPositionDataProvider(): array
];
}

/** @dataProvider inputUntilPositionDataProvider */
#[DataProvider('inputUntilPositionDataProvider')]
public function testGetInputUntilPosition(
string $input,
int $position,
Expand All @@ -188,11 +180,8 @@ public function testGetInputUntilPosition(
$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);
Expand All @@ -205,11 +194,8 @@ public function testIsNextToken(string $input, array $expectedTokens): void
}
}

/**
* @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 {
Expand Down

0 comments on commit 31ad66a

Please sign in to comment.