本文整理汇总了PHP中Magento\Store\Model\System\Store::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::expects方法的具体用法?PHP Store::expects怎么用?PHP Store::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Store\Model\System\Store
的用法示例。
在下文中一共展示了Store::expects方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPrepareDataSource
public function testPrepareDataSource()
{
$dataSource = ['data' => ['items' => [['stores' => [1]]]]];
$expectedVisibility = "Test Website<br/> Test group<br/> Test store<br/>";
$expectedDataSource = ['data' => ['items' => [['stores' => [1], 'visibility' => $expectedVisibility]]]];
$this->storeMock->expects($this->once())->method('getStoresStructure')->willReturn([['label' => 'Test Website', 'children' => [['label' => 'Test group', 'children' => [['label' => 'Test store']]]]]]);
$this->assertEquals($expectedDataSource, $this->getModel()->prepareDataSource($dataSource));
}
示例2: testPrepareDataSource
/**
* @dataProvider prepareDataSourceDataProvider
*/
public function testPrepareDataSource($dataSource, $expectedResult)
{
$website = 'website';
$group = 'group';
$store = 'store';
$storeStructure = [1 => ['value' => 1, 'label' => $website, 'children' => [1 => ['value' => 1, 'label' => $group, 'children' => [1 => ['value' => 1, 'label' => $store]]]]]];
$this->escaperMock->expects($this->any())->method('escapeHtml')->willReturnMap([[$group, null, $group], [$store, null, $store]]);
$this->systemStoreMock->expects($this->any())->method('getStoresStructure')->willReturn($storeStructure);
$this->assertEquals($this->model->prepareDataSource($dataSource), $expectedResult);
}
示例3: prepareMocksForGetCurrencySymbolsData
/**
* Prepare mocks for getCurrencySymbolsData
*
* @param int $websiteId
* @param int $groupId
* @param string $currencies
*/
protected function prepareMocksForGetCurrencySymbolsData($websiteId, $groupId, $currencies)
{
/**
* @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject
*/
$websiteMock = $this->getMock('Magento\\Store\\Model\\Website', ['getId', 'getConfig'], [], '', false);
/**
* @var \Magento\Store\Model\Group|\PHPUnit_Framework_MockObject_MockObject
*/
$groupMock = $this->getMock('Magento\\Store\\Model\\Group', ['getId', 'getWebsiteId'], [], '', false);
/**
* @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject
*/
$storeMock = $this->getMock('Magento\\Store\\Model\\Store', ['getGroupId'], [], '', false);
$this->systemStoreMock->expects($this->once())->method('getWebsiteCollection')->willReturn([$websiteMock]);
$this->systemStoreMock->expects($this->once())->method('getGroupCollection')->willReturn([$groupMock]);
$this->systemStoreMock->expects($this->once())->method('getStoreCollection')->willReturn([$storeMock]);
$websiteMock->expects($this->any())->method('getId')->willReturn($websiteId);
$groupMock->expects($this->any())->method('getWebsiteId')->willReturn($websiteId);
$groupMock->expects($this->any())->method('getId')->willReturn($groupId);
$storeMock->expects($this->any())->method('getGroupId')->willReturn($groupId);
$this->scopeConfigMock->expects($this->any())->method('getValue')->willReturnMap([[CurrencySymbol::XML_PATH_CUSTOM_CURRENCY_SYMBOL, ScopeInterface::SCOPE_STORE, null, ''], [CurrencySymbol::XML_PATH_ALLOWED_CURRENCIES, ScopeInterface::SCOPE_STORE, $storeMock, $currencies], [CurrencySymbol::XML_PATH_ALLOWED_CURRENCIES, ScopeInterface::SCOPE_STORE, null, $currencies], [CurrencySymbol::XML_PATH_ALLOWED_CURRENCIES, ScopeInterface::SCOPE_STORE, $storeMock, $currencies]]);
$websiteMock->expects($this->any())->method('getConfig')->with(CurrencySymbol::XML_PATH_ALLOWED_CURRENCIES)->willReturn($currencies);
$this->localeResolverMock->expects($this->any())->method('getLocale')->willReturn('en');
}
示例4: testToHtmlWithoutRatingData
public function testToHtmlWithoutRatingData()
{
$this->registry->expects($this->any())->method('registry')->will($this->returnValue(false));
$this->systemStore->expects($this->any())->method('getStoreCollection')->will($this->returnValue(['0' => $this->store]));
$this->formFactory->expects($this->any())->method('create')->will($this->returnValue($this->form));
$this->viewFileSystem->expects($this->any())->method('getTemplateFileName')->will($this->returnValue('template_file_name.html'));
$this->fileSystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($this->directoryReadInterface));
$this->block->toHtml();
}
示例5: testToOptionArray
public function testToOptionArray()
{
$websiteCollection = [$this->websiteMock];
$groupCollection = [$this->groupMock];
$storeCollection = [$this->storeMock];
$expectedOptions = [['label' => __('All Store Views'), 'value' => '0'], ['label' => 'Main Website', 'value' => [['label' => ' Main Website Store', 'value' => [['label' => ' Default Store View', 'value' => '1']]]]]];
$this->systemStoreMock->expects($this->once())->method('getWebsiteCollection')->willReturn($websiteCollection);
$this->systemStoreMock->expects($this->once())->method('getGroupCollection')->willReturn($groupCollection);
$this->systemStoreMock->expects($this->once())->method('getStoreCollection')->willReturn($storeCollection);
$this->websiteMock->expects($this->atLeastOnce())->method('getId')->willReturn('1');
$this->websiteMock->expects($this->any())->method('getName')->willReturn('Main Website');
$this->groupMock->expects($this->atLeastOnce())->method('getWebsiteId')->willReturn('1');
$this->groupMock->expects($this->atLeastOnce())->method('getId')->willReturn('1');
$this->groupMock->expects($this->atLeastOnce())->method('getName')->willReturn('Main Website Store');
$this->storeMock->expects($this->atLeastOnce())->method('getGroupId')->willReturn('1');
$this->storeMock->expects($this->atLeastOnce())->method('getName')->willReturn('Default Store View');
$this->storeMock->expects($this->atLeastOnce())->method('getId')->willReturn('1');
$this->escaperMock->expects($this->atLeastOnce())->method('escapeHtml')->willReturnMap([['Default Store View', null, 'Default Store View'], ['Main Website Store', null, 'Main Website Store'], ['Main Website', null, 'Main Website']]);
$this->assertEquals($expectedOptions, $this->options->toOptionArray());
}
示例6: mockOptions
/**
* Mock website options
*
* @return array
*/
protected function mockOptions()
{
$options = [['value' => 'value1', 'label' => 'label1'], ['value' => 'value2', 'label' => 'label2']];
$this->storeMock->expects($this->once())->method('getWebsiteValuesForForm')->with(false, false)->willReturn($options);
return $options;
}