diff --git a/tests/phpunit/PopupsContextTest.php b/tests/phpunit/PopupsContextTest.php index c779da9d4..871b63dff 100644 --- a/tests/phpunit/PopupsContextTest.php +++ b/tests/phpunit/PopupsContextTest.php @@ -67,7 +67,7 @@ class PopupsContextTest extends MediaWikiTestCase { public function testShowPreviewsPreferencesPage( array $config, $expected ) { $this->setMwGlobals( $config ); $context = $this->getContext(); - $this->assertEquals( $expected, + $this->assertSame( $expected, $context->showPreviewsOptInOnPreferencesPage(), 'The previews opt-in is ' . ( $expected ? 'shown.' : 'hidden.' ) ); } @@ -99,7 +99,7 @@ class PopupsContextTest extends MediaWikiTestCase { $context = $this->getContext(); $user = $this->getMutableTestUser()->getUser(); $user->setOption( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, $optIn ); - $this->assertEquals( $expected, + $this->assertSame( $expected, $context->shouldSendModuleToUser( $user ), ( $expected ? 'A' : 'No' ) . ' module is sent to the user.' ); } @@ -129,7 +129,7 @@ class PopupsContextTest extends MediaWikiTestCase { PopupsContext::PREVIEWS_DISABLED ); $context = $this->getContext(); - $this->assertEquals( $expected, + $this->assertSame( $expected, $context->shouldSendModuleToUser( $user ), ( $expected ? 'A' : 'No' ) . ' module is sent to the user.' ); } @@ -162,7 +162,7 @@ class PopupsContextTest extends MediaWikiTestCase { ->method( 'isLoaded' ) ->will( new PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls( $returnValues ) ); $context = $this->getContext( $mock ); - $this->assertEquals( $expected, + $this->assertSame( $expected, $context->areDependenciesMet(), 'Dependencies are ' . ( $expected ? '' : 'not ' ) . 'met.' ); } @@ -210,7 +210,7 @@ class PopupsContextTest extends MediaWikiTestCase { public function testIsTitleBlacklisted( array $blacklist, Title $title, $expected ) { $this->setMwGlobals( [ 'wgPopupsPageBlacklist' => $blacklist ] ); $context = $this->getContext(); - $this->assertEquals( $expected, + $this->assertSame( $expected, $context->isTitleBlacklisted( $title ), 'The title is' . ( $expected ? ' ' : ' not ' ) . 'blacklisted.' ); } @@ -243,7 +243,7 @@ class PopupsContextTest extends MediaWikiTestCase { 'wgLanguageCode' => 'pl' ] ); $context = $this->getContext(); - $this->assertEquals( true, + $this->assertTrue( $context->isTitleBlacklisted( Title::newFromText( $page ) ), 'The title is blacklisted.' ); } @@ -265,7 +265,7 @@ class PopupsContextTest extends MediaWikiTestCase { ->willReturn( true ); $context = $this->getContext( null, $integrationMock ); - $this->assertEquals( true, + $this->assertTrue( $context->conflictsWithNavPopupsGadget( $user ), 'A conflict is identified.' ); } diff --git a/tests/phpunit/PopupsGadgetsIntegrationTest.php b/tests/phpunit/PopupsGadgetsIntegrationTest.php index e1980e671..1f3351599 100644 --- a/tests/phpunit/PopupsGadgetsIntegrationTest.php +++ b/tests/phpunit/PopupsGadgetsIntegrationTest.php @@ -89,7 +89,7 @@ class PopupsGadgetsIntegrationTest extends MediaWikiTestCase { $user = $this->getTestUser()->getUser(); $integration = new PopupsGadgetsIntegration( $this->getConfigMock(), $this->getExtensionRegistryMock( false ) ); - $this->assertEquals( false, + $this->assertFalse( $integration->conflictsWithNavPopupsGadget( $user ), 'No conflict is identified.' ); } @@ -241,7 +241,7 @@ class PopupsGadgetsIntegrationTest extends MediaWikiTestCase { $integration = new PopupsGadgetsIntegration( $config, $this->getExtensionRegistryMock( true ) ); - $this->assertEquals( $expected, + $this->assertSame( $expected, $integration->conflictsWithNavPopupsGadget( $user ), ( $expected ? 'A' : 'No' ) . ' conflict is identified.' ); diff --git a/tests/phpunit/PopupsHooksTest.php b/tests/phpunit/PopupsHooksTest.php index 44ed24c64..06a4ab7ac 100644 --- a/tests/phpunit/PopupsHooksTest.php +++ b/tests/phpunit/PopupsHooksTest.php @@ -50,7 +50,7 @@ class PopupsHooksTest extends MediaWikiTestCase { PopupsHooks::onGetPreferences( $this->getTestUser()->getUser(), $prefs ); $this->assertCount( 1, $prefs, 'No preferences are retrieved.' ); - $this->assertEquals( 'notEmpty', + $this->assertSame( 'notEmpty', $prefs[ 'someNotEmptyValue'], 'No preferences are changed.' ); } @@ -84,7 +84,7 @@ class PopupsHooksTest extends MediaWikiTestCase { $this->assertArrayHasKey( 'disabled', $prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ], 'The opt-in preference has a status.' ); - $this->assertEquals( true, + $this->assertTrue( $prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['disabled'], 'The opt-in preference\'s status is disabled.' ); $this->assertNotEmpty( $prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['help-message'], @@ -116,13 +116,13 @@ class PopupsHooksTest extends MediaWikiTestCase { PopupsHooks::onGetPreferences( $this->getTestUser()->getUser(), $prefs ); $this->assertCount( 4, $prefs, 'A preference is retrieved.' ); - $this->assertEquals( 'notEmpty', + $this->assertSame( 'notEmpty', $prefs[ 'someNotEmptyValue'], 'Unretrieved preferences are unchanged.' ); $this->assertArrayHasKey( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, $prefs, 'The opt-in preference is retrieved.' ); - $this->assertEquals( 1, + $this->assertSame( 1, array_search( \Popups\PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, array_keys( $prefs ) ), 'The opt-in preference is injected after Skin select.' ); @@ -155,7 +155,7 @@ class PopupsHooksTest extends MediaWikiTestCase { $this->assertArrayHasKey( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, $prefs, 'The opt-in preference is retrieved.' ); - $this->assertEquals( 2, + $this->assertSame( 2, array_search( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME, array_keys( $prefs ) ), 'The opt-in preference is appended.' ); @@ -178,7 +178,7 @@ class PopupsHooksTest extends MediaWikiTestCase { $this->assertCount( 6, $vars, 'A configuration is retrieved.' ); foreach ( $config as $key => $value ) { - $this->assertEquals( + $this->assertSame( $value, $vars[ $key ], "It forwards the \"{$key}\" config variable to the client." @@ -322,7 +322,7 @@ class PopupsHooksTest extends MediaWikiTestCase { PopupsHooks::onUserGetDefaultOptions( $userOptions ); $this->assertCount( 2, $userOptions ); - $this->assertEquals( '1', + $this->assertSame( '1', $userOptions[ \Popups\PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] ); }