本文整理汇总了PHP中Drupal\Core\Extension\ExtensionDiscovery::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionDiscovery::expects方法的具体用法?PHP ExtensionDiscovery::expects怎么用?PHP ExtensionDiscovery::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Extension\ExtensionDiscovery
的用法示例。
在下文中一共展示了ExtensionDiscovery::expects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRebuildThemeDataWithThemeParents
/**
* Tests rebuild the theme data with theme parents.
*/
public function testRebuildThemeDataWithThemeParents()
{
$this->extensionDiscovery->expects($this->at(0))->method('scan')->with('theme')->will($this->returnValue(array('test_subtheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml', 'test_subtheme.info.yml'), 'test_basetheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml', 'test_basetheme.info.yml'))));
$this->extensionDiscovery->expects($this->at(1))->method('scan')->with('theme_engine')->will($this->returnValue(array('twig' => new Extension($this->root, 'theme_engine', $this->root . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'))));
$this->infoParser->expects($this->at(0))->method('parse')->with($this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml')->will($this->returnCallback(function ($file) {
$info_parser = new InfoParser();
return $info_parser->parse($file);
}));
$this->infoParser->expects($this->at(1))->method('parse')->with($this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml')->will($this->returnCallback(function ($file) {
$info_parser = new InfoParser();
return $info_parser->parse($file);
}));
$this->moduleHandler->expects($this->once())->method('buildModuleDependencies')->will($this->returnArgument(0));
$theme_data = $this->themeHandler->rebuildThemeData();
$this->assertCount(2, $theme_data);
$info_basetheme = $theme_data['test_basetheme'];
$info_subtheme = $theme_data['test_subtheme'];
// Ensure some basic properties.
$this->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info_basetheme);
$this->assertEquals('test_basetheme', $info_basetheme->getName());
$this->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info_subtheme);
$this->assertEquals('test_subtheme', $info_subtheme->getName());
// Test the parent/child-theme properties.
$info_subtheme->info['base theme'] = 'test_basetheme';
$info_basetheme->sub_themes = array('test_subtheme');
$this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_basetheme->owner);
$this->assertEquals('twig', $info_basetheme->prefix);
$this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_subtheme->owner);
$this->assertEquals('twig', $info_subtheme->prefix);
}