From 9e1e44910e2b518073402d94b44eae2f5d67e6eb Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 7 Apr 2019 00:02:28 +0100 Subject: [PATCH] resourceloader: Add missing (string) cast to ClientHtml tests One of the assertions already did this, but the others not yet. The reason we do this is because the return value is a WrappedString object. The assertEquals() method is able to satisfy the expected value because of loose comparison casting it to a string for the case where it matches. But, when it fails during development, PHPUnit was still printing the object as "Actual" and the string as "Expected" which makes it difficult to understand what's going on, and also no diff. Change-Id: Ice9fe5061fb76867e9bee2f34c88d3ddac3144f9 --- .../resourceloader/ResourceLoaderClientHtmlTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index 825c9b9906..9ab3a2dae3 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -120,7 +120,7 @@ Deprecation message.' ] // phpcs:enable $expected = self::expandVariables( $expected ); - $this->assertEquals( $expected, $client->getHeadHtml() ); + $this->assertSame( $expected, (string)$client->getHeadHtml() ); } /** @@ -137,7 +137,7 @@ Deprecation message.' ] . ''; // phpcs:enable - $this->assertEquals( $expected, $client->getHeadHtml() ); + $this->assertSame( $expected, (string)$client->getHeadHtml() ); } /** @@ -154,7 +154,7 @@ Deprecation message.' ] . ''; // phpcs:enable - $this->assertEquals( $expected, $client->getHeadHtml() ); + $this->assertSame( $expected, (string)$client->getHeadHtml() ); } /** @@ -171,7 +171,7 @@ Deprecation message.' ] . ''; // phpcs:enable - $this->assertEquals( $expected, $client->getHeadHtml() ); + $this->assertSame( $expected, (string)$client->getHeadHtml() ); } public function testGetBodyHtml() { @@ -193,7 +193,7 @@ Deprecation message.' ] . '});'; // phpcs:enable - $this->assertEquals( $expected, $client->getBodyHtml() ); + $this->assertSame( $expected, (string)$client->getBodyHtml() ); } public static function provideMakeLoad() { @@ -339,7 +339,7 @@ Deprecation message.' ] $context->getResourceLoader()->register( self::makeSampleModules() ); $actual = ResourceLoaderClientHtml::makeLoad( $context, $modules, $type, $extraQuery, false ); $expected = self::expandVariables( $expected ); - $this->assertEquals( $expected, (string)$actual ); + $this->assertSame( $expected, (string)$actual ); } public function testGetDocumentAttributes() { -- 2.20.1