本文整理汇总了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());
}