当前位置: 首页>>代码示例>>PHP>>正文


PHP ExtensionDiscovery::expects方法代码示例

本文整理汇总了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);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:33,代码来源:ThemeHandlerTest.php


注:本文中的Drupal\Core\Extension\ExtensionDiscovery::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。