From: Timo Tijhof Date: Tue, 27 Mar 2018 21:23:38 +0000 (-0700) Subject: resourceloader: Add test for ClientHtml passing down 'target' X-Git-Tag: 1.31.0-rc.0~258^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%24wgLogo?a=commitdiff_plain;h=4937a7430e98499fef89724a7a93aa6e05fd6b64;p=lhc%2Fweb%2Fwiklou.git resourceloader: Add test for ClientHtml passing down 'target' This was not previously tested. Change-Id: I25d9ec28b712b0b699f1369b284faf337b8af5aa --- diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php index a75ea56879..4f66bd9744 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php @@ -217,6 +217,44 @@ class ResourceLoaderClientHtmlTest extends PHPUnit\Framework\TestCase { $this->assertEquals( $expected, $client->getHeadHtml() ); } + /** + * Confirm that 'target' is passed down to the startup module's load url. + * + * @covers ResourceLoaderClientHtml::getHeadHtml + */ + public function testGetHeadHtmlWithTarget() { + $client = new ResourceLoaderClientHtml( + self::makeContext(), + 'example' + ); + + // phpcs:disable Generic.Files.LineLength + $expected = '' . "\n" + . ''; + // phpcs:enable + + $this->assertEquals( $expected, $client->getHeadHtml() ); + } + + /** + * Confirm that a null 'target' is the same as no target. + * + * @covers ResourceLoaderClientHtml::getHeadHtml + */ + public function testGetHeadHtmlWithNullTarget() { + $client = new ResourceLoaderClientHtml( + self::makeContext(), + null + ); + + // phpcs:disable Generic.Files.LineLength + $expected = '' . "\n" + . ''; + // phpcs:enable + + $this->assertEquals( $expected, $client->getHeadHtml() ); + } + /** * @covers ResourceLoaderClientHtml::getBodyHtml * @covers ResourceLoaderClientHtml::getLoad