X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fresourceloader%2FResourceLoaderClientHtmlTest.php;h=c83f5004dba838745151e1bc444e17140ac7868b;hb=8a95833baed3b8071fcbd8cd2bc8c3449409f665;hp=3530d3c1d3e29ff5192445c54986e09e5abe4354;hpb=237d3271fd313ebe09858a5c442a91216a7b61cf;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
index 3530d3c1d3..c83f5004db 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php
@@ -7,6 +7,8 @@ use Wikimedia\TestingAccessWrapper;
*/
class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
+ use MediaWikiCoversValidator;
+
protected static function expandVariables( $text ) {
return strtr( $text, [
'{blankVer}' => ResourceLoaderTestCase::BLANK_VERSION
@@ -43,6 +45,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'test.top' => [ 'position' => 'top' ],
'test.private.top' => [ 'group' => 'private', 'position' => 'top' ],
'test.private.bottom' => [ 'group' => 'private', 'position' => 'bottom' ],
+ 'test.shouldembed.empty' => [ 'shouldEmbed' => true, 'isKnownEmpty' => true ],
'test.shouldembed' => [ 'shouldEmbed' => true ],
'test.styles.pure' => [ 'type' => ResourceLoaderModule::LOAD_STYLES ],
@@ -115,6 +118,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'test.private.bottom',
'test.private.top',
'test.top',
+ 'test.shouldembed.empty',
'test.shouldembed',
'test.unregistered',
] );
@@ -138,6 +142,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'states' => [
'test.private.top' => 'loading',
'test.private.bottom' => 'loading',
+ 'test.shouldembed.empty' => 'ready',
'test.shouldembed' => 'loading',
'test.styles.pure' => 'ready',
'test.styles.user.empty' => 'ready',
@@ -202,7 +207,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'test.exempt' => 'ready',
] );
- // @codingStandardsIgnoreStart Generic.Files.LineLength
+ // phpcs:disable Generic.Files.LineLength
$expected = '' . "\n"
. '';
- // @codingStandardsIgnoreEnd
+ // phpcs:enable
$expected = self::expandVariables( $expected );
$this->assertEquals( $expected, $client->getHeadHtml() );
@@ -245,8 +250,8 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
}
public static function provideMakeLoad() {
+ // phpcs:disable Generic.Files.LineLength
return [
- // @codingStandardsIgnoreStart Generic.Files.LineLength
[
'context' => [],
'modules' => [ 'test.unknown' ],
@@ -272,6 +277,12 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'output' => '',
],
+ [
+ 'context' => [ 'sync' => true ],
+ 'modules' => [ 'test.scripts.raw' ],
+ 'only' => ResourceLoaderModule::TYPE_SCRIPTS,
+ 'output' => '',
+ ],
[
'context' => [],
'modules' => [ 'test.scripts.user' ],
@@ -338,8 +349,8 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
. '' . "\n"
. ''
],
- // @codingStandardsIgnoreEnd
];
+ // phpcs:enable
}
/**
@@ -357,7 +368,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
public function testMakeLoad( array $extraQuery, array $modules, $type, $expected ) {
$context = self::makeContext( $extraQuery );
$context->getResourceLoader()->register( self::makeSampleModules() );
- $actual = ResourceLoaderClientHtml::makeLoad( $context, $modules, $type );
+ $actual = ResourceLoaderClientHtml::makeLoad( $context, $modules, $type, $extraQuery );
$expected = self::expandVariables( $expected );
$this->assertEquals( $expected, (string)$actual );
}