Skip to content

Commit 3198d60

Browse files
jenkins-botGerrit Code Review
authored andcommitted
Merge "phpunit: Use "@" instead of temporary error_reporting override"
2 parents 0a3dfb5 + 35b3d75 commit 3198d60

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

.phpcs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
</rule>
3636
<rule ref="Generic.PHP.NoSilencedErrors.Discouraged">
3737
<exclude-pattern>tests/phpunit/*</exclude-pattern>
38+
<!-- For /lib/packages/*/tests/unit/**/*.php -->
39+
<exclude-pattern>tests/unit/*</exclude-pattern>
3840
</rule>
3941

4042
<!-- NOTE: We can not use the Squiz.Arrays.ArrayBracketSpacing sniff because it conflicts with

lib/packages/wikibase/data-model-services/tests/unit/Diff/ItemDiffTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,13 @@ public function testIsEmpty( array $diffOps, $isEmpty ) {
229229
* diffs for substructures even in recursive mode (bug 51363).
230230
*/
231231
public function testAtomicSubstructureWorkaround() {
232-
$oldErrorLevel = error_reporting( E_USER_ERROR );
233-
234232
$atomicListDiff = new DiffOpChange(
235233
[ 'a' => 'A', 'b' => 'B' ],
236234
[ 'b' => 'B', 'a' => 'A' ]
237235
);
238236

239-
$diff = new ItemDiff( [
237+
// Ignore intentional warning for "Invalid substructure diff"
238+
$diff = @new ItemDiff( [
240239
'aliases' => $atomicListDiff,
241240
'label' => $atomicListDiff,
242241
'description' => $atomicListDiff,
@@ -249,8 +248,6 @@ public function testAtomicSubstructureWorkaround() {
249248
$this->assertInstanceOf( Diff::class, $diff->getDescriptionsDiff() );
250249
$this->assertInstanceOf( Diff::class, $diff->getClaimsDiff() );
251250
$this->assertInstanceOf( Diff::class, $diff->getSiteLinkDiff() );
252-
253-
error_reporting( $oldErrorLevel );
254251
}
255252

256253
}

0 commit comments

Comments
 (0)