本文整理汇总了PHP中Drupal\Core\Extension\ThemeHandlerInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHandlerInterface::expects方法的具体用法?PHP ThemeHandlerInterface::expects怎么用?PHP ThemeHandlerInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Extension\ThemeHandlerInterface
的用法示例。
在下文中一共展示了ThemeHandlerInterface::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
// Create a config mock which does not mock the clear(), set() and get() methods.
$methods = get_class_methods('Drupal\\Core\\Config\\Config');
unset($methods[array_search('set', $methods)]);
unset($methods[array_search('get', $methods)]);
unset($methods[array_search('clear', $methods)]);
$config_mock = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->setMethods($methods)->getMock();
// Create the config factory we use in the submitForm() function.
$this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
$this->configFactory->expects($this->any())->method('getEditable')->will($this->returnValue($config_mock));
// Create a MailsystemManager mock.
$this->mailManager = $this->getMock('\\Drupal\\mailsystem\\MailsystemManager', array(), array(), '', FALSE);
$this->mailManager->expects($this->any())->method('getDefinition')->will($this->returnValueMap(array(array('mailsystem_test', TRUE, array('label' => 'Test Mail-Plugin')), array('mailsystem_demo', TRUE, array('label' => 'Demo Mail-Plugin')))));
$this->mailManager->expects($this->any())->method('getDefinitions')->will($this->returnValue(array(array('id' => 'mailsystem_test', 'label' => 'Test Mail-Plugin'), array('id' => 'mailsystem_demo', 'label' => 'Demo Mail-Plugin'))));
// Create a module handler mock.
$this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
$this->moduleHandler->expects($this->any())->method('getImplementations')->with('mail')->will($this->returnValue(array('mailsystem_test', 'mailsystem_demo')));
$this->moduleHandler->expects($this->any())->method('moduleExists')->withAnyParameters()->will($this->returnValue(FALSE));
// Create a theme handler mock.
$this->themeHandler = $this->getMock('\\Drupal\\Core\\Extension\\ThemeHandlerInterface');
$this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('test_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name')), 'demo_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name demo')), 'inactive_theme' => (object) array('status' => 0, 'info' => array('name' => 'inactive test theme')))));
// Inject a language-manager into \Drupal.
$this->languageManager = $this->getMock('\\Drupal\\Core\\StringTranslation\\TranslationInterface');
$this->languageManager->expects($this->any())->method('translate')->withAnyParameters()->will($this->returnArgument(0));
$container = new ContainerBuilder();
$container->set('string_translation', $this->languageManager);
\Drupal::setContainer($container);
}
示例2: setUp
/**
* {@inheritdoc}
*/
public function setUp()
{
parent::setUp();
$this->directoryList = array('system' => 'core/modules/system');
$this->themeHandler = $this->getMock('Drupal\\Core\\Extension\\ThemeHandlerInterface');
$theme = new Extension('theme', DRUPAL_ROOT . '/core/themes/bartik', 'bartik.info.yml');
$theme->status = 1;
$theme->info = array('name' => 'bartik');
$this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('bartik' => $theme)));
$this->container->set('theme_handler', $this->themeHandler);
}