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


PHP Store::expects方法代码示例

本文整理汇总了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/>&nbsp;&nbsp;&nbsp;Test group<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:8,代码来源:VisibilityTest.php

示例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);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:13,代码来源:StoreTest.php

示例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');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:CurrencysymbolTest.php

示例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();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:9,代码来源:FormTest.php

示例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());
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:20,代码来源:OptionsTest.php

示例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;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:WebsiteTest.php


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