本文整理汇总了PHP中Drupal\Core\Config\Config::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::expects方法的具体用法?PHP Config::expects怎么用?PHP Config::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Config
的用法示例。
在下文中一共展示了Config::expects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareExchangeRates
/**
* Stores random exchange rates in the mocked config and returns them.
*
* @return array
* An array of the same format as the return value of
* \Drupal\currency\Plugin\Currency\ExchangeRateProvider\FixedRates::loadAll().
*/
protected function prepareExchangeRates()
{
$rates = array('EUR' => array('DEM' => '1.95583', 'NLG' => '2.20371'), 'NLG' => array('EUR' => '0.453780216'));
$rates_data = array();
foreach ($rates as $currency_code_from => $currency_code_from_rates) {
foreach ($currency_code_from_rates as $currency_code_to => $rate) {
$rates_data[] = array('currency_code_from' => $currency_code_from, 'currency_code_to' => $currency_code_to, 'rate' => $rate);
}
}
$this->config = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock();
$this->config->expects($this->any())->method('get')->with('rates')->willReturn($rates_data);
$this->configFactory->expects($this->any())->method('get')->with('currency.exchanger.fixed_rates')->willReturn($this->config);
$this->configFactory->expects($this->any())->method('getEditable')->with('currency.exchanger.fixed_rates')->willReturn($this->config);
return array($rates, $rates_data);
}