Skip to content

Commit 16e2d26

Browse files
committed
build: Update phpunit/phpunit to 10.5.58
- Update PHPUnit config for version 10 with `--migrate-configuration` - Enabled options to display all notices, deprecations, etc. - Suppress the deprecation notice for getMockForAbstractClass (T407015) - Add missing @Covers Change-Id: I9a7610a524166c2d5f417ac5dcc66522341f37fc
1 parent 6da71c7 commit 16e2d26

11 files changed

+44
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"mediawiki/minus-x": "1.1.3",
3333
"php-parallel-lint/php-console-highlighter": "1.0.0",
3434
"php-parallel-lint/php-parallel-lint": "1.4.0",
35-
"phpunit/phpunit": "9.6.21",
35+
"phpunit/phpunit": "10.5.58",
3636
"wikimedia/testing-access-wrapper": "~2.0.0 || ~3.0.0",
3737
"wikimedia/update-history": "^1.0.1"
3838
},

phpunit.xml.dist

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage includeUncoveredFiles="true">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
colors="true"
5+
displayDetailsOnTestsThatTriggerDeprecations="true"
6+
displayDetailsOnTestsThatTriggerErrors="true"
7+
displayDetailsOnTestsThatTriggerNotices="true"
8+
displayDetailsOnTestsThatTriggerWarnings="true"
9+
displayDetailsOnPhpunitDeprecations="true"
10+
requireCoverageMetadata="true"
11+
beStrictAboutTestsThatDoNotTestAnything="true"
12+
beStrictAboutOutputDuringTests="true"
13+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd">
14+
<source>
415
<include>
516
<directory suffix=".php">./src</directory>
617
</include>
7-
</coverage>
18+
</source>
819
<php>
920
<!-- The default of 100 is too low -->
1021
<ini name="xdebug.max_nesting_level" value="1000"/>

tests/Grammar/AlternativeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function testException() {
3434
public function testGenerateMatches( $rets, $expect ) {
3535
$matchers = [];
3636
foreach ( $rets as $ret ) {
37+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
3738
$matcher = $this->getMockBuilder( Matcher::class )
3839
->onlyMethods( [ 'generateMatches' ] )
3940
->getMockForAbstractClass();

tests/Grammar/CheckedMatcherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
class CheckedMatcherTest extends MatcherTestBase {
1616

1717
public function testGenerateMatches() {
18+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
1819
$matcher = $this->getMockBuilder( Matcher::class )
1920
->onlyMethods( [ 'generateMatches' ] )
2021
->getMockForAbstractClass();

tests/Grammar/MatcherTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function testCreate() {
4444
}
4545

4646
public function testDefaultOptions() {
47+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
4748
$matcher = $this->getMockForAbstractClass( Matcher::class );
4849
'@phan-var Matcher $matcher';
4950

@@ -74,6 +75,7 @@ public function testDefaultOptions() {
7475

7576
public function testNext() {
7677
$matcher = TestingAccessWrapper::newFromObject(
78+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
7779
$this->getMockForAbstractClass( Matcher::class )
7880
);
7981

@@ -115,6 +117,7 @@ public function testNext() {
115117
* @param bool $expect
116118
*/
117119
public function testMatch( $list, $options, $ret, $expectStart, $expect ) {
120+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
118121
$matcher = $this->getMockBuilder( Matcher::class )
119122
->onlyMethods( [ 'generateMatches' ] )
120123
->getMockForAbstractClass();
@@ -196,6 +199,7 @@ public function testMatchSignificantWhitespace() {
196199
$Iws, $tok, $ws, $Iws, $tok, $ws, $expectBlock, $ws
197200
] );
198201

202+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
199203
$matcher = $this->getMockForAbstractClass( Matcher::class );
200204
$matcher->method( 'generateMatches' )->willReturn( new ArrayIterator( [
201205
new GrammarMatch( $testList, 1, 6, null, [
@@ -224,6 +228,7 @@ public function testMatchSignificantWhitespace() {
224228
public function testMakeMatch() {
225229
$dummy = new ComponentValueList();
226230
$matcher = TestingAccessWrapper::newFromObject(
231+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
227232
$this->getMockForAbstractClass( Matcher::class )
228233
);
229234
$matcher2 = TestingAccessWrapper::newFromObject( $matcher->capture( 'foo' ) );

tests/Grammar/NonEmptyTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class NonEmptyTest extends MatcherTestBase {
2222
* @param array $expect
2323
*/
2424
public function testGenerateMatches( $start, $ret, $expect ) {
25+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
2526
$matcher = $this->getMockBuilder( Matcher::class )
2627
->onlyMethods( [ 'generateMatches' ] )
2728
->getMockForAbstractClass();

tests/Grammar/QuantifierTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public static function provideGenerateMatches() {
167167

168168
public function testEmptyMatch() {
169169
$list = new ComponentValueList();
170+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
170171
$matcher = $this->getMockBuilder( Matcher::class )
171172
->onlyMethods( [ 'generateMatches' ] )
172173
->getMockForAbstractClass();

tests/Parser/DataSourceTokenizerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function testCharacterNormalization() {
3434
$this->assertSame( '-', $t->nextChar() );
3535
$this->assertSame( DataSource::EOF, $t->nextChar() );
3636

37+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
3738
$mock = $this->getMockForAbstractClass( DataSource::class );
3839
$mock->method( 'readCharacter' )->willReturnOnConsecutiveCalls(
3940
"\u{D7FF}", "\u{D800}", "\u{DFFF}", "\u{E000}", DataSource::EOF

tests/Sanitizer/CounterStyleRuleSanitizerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
use Wikimedia\CSS\Sanitizer\RuleSanitizerTestBase;
66

77
// phpcs:disable Generic.Files.LineLength
8+
9+
/**
10+
* @covers \Wikimedia\CSS\Sanitizer\CounterStyleAtRuleSanitizer
11+
*/
812
class CounterStyleRuleSanitizerTest extends RuleSanitizerTestBase {
913

1014
protected function getSanitizer( $options = [] ) {

tests/Sanitizer/RuleSanitizerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class RuleSanitizerTest extends RuleSanitizerTestBase {
2323
protected function getSanitizer( $options = [] ) {
2424
$mb = $this->getMockBuilder( RuleSanitizer::class )
2525
->onlyMethods( [ 'doSanitize', 'handlesRule' ] );
26+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
2627
$san = $mb->getMockForAbstractClass();
2728
$san->method( 'handlesRule' )->willReturn( true );
2829

@@ -34,6 +35,7 @@ protected function getSanitizer( $options = [] ) {
3435

3536
case 'rules':
3637
$method = 'sanitizeRuleBlock';
38+
// @phan-suppress-next-line PhanDeprecatedFunction Soft-deprecated in phpunit 10
3739
$arg = [ $mb->getMockForAbstractClass() ];
3840
$arg[0]->method( 'handlesRule' )->willReturnCallback( static function ( $rule ) {
3941
return $rule instanceof AtRule && !strcasecmp( $rule->getName(), 'foo' );

0 commit comments

Comments
 (0)