Skip to content

Commit 31ad66a

Browse files
authored
PHPUnit 10 (#117)
1 parent 9a3516d commit 31ad66a

File tree

5 files changed

+27
-35
lines changed

5 files changed

+27
-35
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/vendor
22
/composer.lock
33
/phpunit.xml
4-
/.phpunit.result.cache
4+
/.phpunit.cache
55
/phpcs.xml
66
/.phpcs-cache

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"require-dev": {
3232
"doctrine/coding-standard": "^12",
3333
"phpstan/phpstan": "^1.10",
34-
"phpunit/phpunit": "^9.6",
34+
"phpunit/phpunit": "^10.5",
3535
"psalm/plugin-phpunit": "^0.18.3",
3636
"vimeo/psalm": "^5.21"
3737
},

phpunit.xml.dist

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
88
bootstrap="vendor/autoload.php"
9-
convertNoticesToExceptions="true"
9+
cacheDirectory=".phpunit.cache"
1010
>
1111
<php>
12-
<ini name="error_reporting" value="-1" />
12+
<ini name="error_reporting" value="-1" />
1313
</php>
1414

1515
<testsuites>
@@ -18,9 +18,9 @@
1818
</testsuite>
1919
</testsuites>
2020

21-
<filter>
22-
<whitelist>
21+
<source>
22+
<include>
2323
<directory suffix=".php">src</directory>
24-
</whitelist>
25-
</filter>
24+
</include>
25+
</source>
2626
</phpunit>

psalm.xml

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
<file name="src/Token.php" />
4444
</errorLevel>
4545
</MixedReturnStatement>
46+
<PossiblyUnusedMethod>
47+
<errorLevel type="suppress">
48+
<!-- https://github.com/psalm/psalm-plugin-phpunit/issues/131 -->
49+
<file name="tests/AbstractLexerTest.php" />
50+
</errorLevel>
51+
</PossiblyUnusedMethod>
4652
<PossiblyUnusedProperty>
4753
<errorLevel type="suppress">
4854
<!-- TODO: Cover this property in a test -->

tests/AbstractLexerTest.php

+12-26
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\Tests\Common\Lexer;
66

77
use Doctrine\Common\Lexer\Token;
8+
use PHPUnit\Framework\Attributes\DataProvider;
89
use PHPUnit\Framework\TestCase;
910

1011
use function array_map;
@@ -82,11 +83,8 @@ public function testResetPosition(): void
8283
$this->assertEquals($expectedTokens[0], $this->concreteLexer->lookahead);
8384
}
8485

85-
/**
86-
* @psalm-param list<Token<string, string|int>> $expectedTokens
87-
*
88-
* @dataProvider dataProvider
89-
*/
86+
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
87+
#[DataProvider('dataProvider')]
9088
public function testMoveNext(string $input, array $expectedTokens): void
9189
{
9290
$this->concreteLexer->setInput($input);
@@ -126,11 +124,8 @@ public function testUtf8Mismatch(): void
126124
);
127125
}
128126

129-
/**
130-
* @psalm-param list<Token<string, string|int>> $expectedTokens
131-
*
132-
* @dataProvider dataProvider
133-
*/
127+
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
128+
#[DataProvider('dataProvider')]
134129
public function testPeek(string $input, array $expectedTokens): void
135130
{
136131
$this->concreteLexer->setInput($input);
@@ -146,11 +141,8 @@ public function testPeek(string $input, array $expectedTokens): void
146141
$this->assertNull($this->concreteLexer->peek());
147142
}
148143

149-
/**
150-
* @psalm-param list<Token<string, string|int>> $expectedTokens
151-
*
152-
* @dataProvider dataProvider
153-
*/
144+
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
145+
#[DataProvider('dataProvider')]
154146
public function testGlimpse(string $input, array $expectedTokens): void
155147
{
156148
$this->concreteLexer->setInput($input);
@@ -177,7 +169,7 @@ public static function inputUntilPositionDataProvider(): array
177169
];
178170
}
179171

180-
/** @dataProvider inputUntilPositionDataProvider */
172+
#[DataProvider('inputUntilPositionDataProvider')]
181173
public function testGetInputUntilPosition(
182174
string $input,
183175
int $position,
@@ -188,11 +180,8 @@ public function testGetInputUntilPosition(
188180
$this->assertSame($expectedInput, $this->concreteLexer->getInputUntilPosition($position));
189181
}
190182

191-
/**
192-
* @psalm-param list<Token<string, string|int>> $expectedTokens
193-
*
194-
* @dataProvider dataProvider
195-
*/
183+
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
184+
#[DataProvider('dataProvider')]
196185
public function testIsNextToken(string $input, array $expectedTokens): void
197186
{
198187
$this->concreteLexer->setInput($input);
@@ -205,11 +194,8 @@ public function testIsNextToken(string $input, array $expectedTokens): void
205194
}
206195
}
207196

208-
/**
209-
* @psalm-param list<Token<string, string|int>> $expectedTokens
210-
*
211-
* @dataProvider dataProvider
212-
*/
197+
/** @psalm-param list<Token<string, string|int>> $expectedTokens */
198+
#[DataProvider('dataProvider')]
213199
public function testIsNextTokenAny(string $input, array $expectedTokens): void
214200
{
215201
$allTokenTypes = array_map(static function ($token): string {

0 commit comments

Comments
 (0)