tests: Replace assert(Not)Empty with assert(Not)Same

assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: Ia6f0cc449f42ef078eb69667d0ce1706022de19b
This commit is contained in:
Umherirrender 2022-11-24 23:07:17 +01:00 committed by Thiemo Kreuz (WMDE)
parent 5b754dc615
commit fd816a2a7c
2 changed files with 2 additions and 3 deletions

View file

@ -2,7 +2,6 @@
<ruleset> <ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" /> <exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.PHPUnit.AssertEmpty.AssertEmptyUsed" />
</rule> </rule>
<file>.</file> <file>.</file>
<arg name="extensions" value="php" /> <arg name="extensions" value="php" />

View file

@ -69,9 +69,9 @@ class HooksTest extends MediaWikiLangTestCase {
( new Hooks() )->onSkinAfterContent( $data, $sk ); ( new Hooks() )->onSkinAfterContent( $data, $sk );
if ( $enabled ) { if ( $enabled ) {
$this->assertNotEmpty( $data, 'Cookie warning should be present' ); $this->assertNotSame( '', $data, 'Cookie warning should be present' );
} else { } else {
$this->assertEmpty( $data, 'Cookie warning should not be present' ); $this->assertSame( '', $data, 'Cookie warning should not be present' );
return; return;
} }