From: Timo Tijhof Date: Sat, 6 Apr 2019 23:02:28 +0000 (+0100) Subject: resourceloader: Add missing (string) cast to ClientHtml tests X-Git-Tag: 1.34.0-rc.0~2105^2~1 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=9e1e44910e2b518073402d94b44eae2f5d67e6eb;p=lhc%2Fweb%2Fwiklou.git 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 --- 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() {