本文整理匯總了PHP中ResourceLoaderContext::newDummyContext方法的典型用法代碼示例。如果您正苦於以下問題:PHP ResourceLoaderContext::newDummyContext方法的具體用法?PHP ResourceLoaderContext::newDummyContext怎麽用?PHP ResourceLoaderContext::newDummyContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ResourceLoaderContext
的用法示例。
在下文中一共展示了ResourceLoaderContext::newDummyContext方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetPages
/**
* @dataProvider provideGetPages
* @covers ResourceLoaderWikiModule::getPages
*/
public function testGetPages($params, Config $config, $expected)
{
$module = new ResourceLoaderWikiModule($params);
$module->setConfig($config);
// Use getDefinitionSummary because getPages is protected
$summary = $module->getDefinitionSummary(ResourceLoaderContext::newDummyContext());
$this->assertEquals($expected, $summary['pages']);
}
示例2: testGetPages
/**
* @dataProvider provideGetPages
* @covers ResourceLoaderWikiModule::getPages
*/
public function testGetPages($params, Config $config, $expected)
{
$module = new ResourceLoaderWikiModule($params);
$module->setConfig($config);
// Because getPages is protected..
$getPages = new ReflectionMethod($module, 'getPages');
$getPages->setAccessible(true);
$out = $getPages->invoke($module, ResourceLoaderContext::newDummyContext());
$this->assertEquals($expected, $out);
}
示例3: readStyleFiles
/**
* Gets the contents of a list of CSS files.
*
* @param array $styles List of media type/list of file paths pairs, to read, remap and
* concetenate
* @param bool $flip
* @param ResourceLoaderContext $context
*
* @throws MWException
* @return array List of concatenated and remapped CSS data from $styles,
* keyed by media type
*
* @since 1.27 Calling this method without a ResourceLoaderContext instance
* is deprecated.
*/
public function readStyleFiles(array $styles, $flip, $context = null)
{
if ($context === null) {
wfDeprecated(__METHOD__ . ' without a ResourceLoader context', '1.27');
$context = ResourceLoaderContext::newDummyContext();
}
if (empty($styles)) {
return [];
}
foreach ($styles as $media => $files) {
$uniqueFiles = array_unique($files, SORT_REGULAR);
$styleFiles = [];
foreach ($uniqueFiles as $file) {
$styleFiles[] = $this->readStyleFile($file, $flip, $context);
}
$styles[$media] = implode("\n", $styleFiles);
}
return $styles;
}
示例4: getLoaderScript
/**
* Gets loader script.
*
* @return String: JavaScript code to be added to startup module
*/
public function getLoaderScript()
{
if (count($this->loaderScripts) == 0) {
return false;
}
return $this->readScriptFiles($this->loaderScripts, ResourceLoaderContext::newDummyContext());
}
示例5: testDummy
public function testDummy()
{
$this->assertInstanceOf(ResourceLoaderContext::class, ResourceLoaderContext::newDummyContext());
}