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


PHP TimezoneInterface::expects方法代码示例

本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP TimezoneInterface::expects方法的具体用法?PHP TimezoneInterface::expects怎么用?PHP TimezoneInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Stdlib\DateTime\TimezoneInterface的用法示例。


在下文中一共展示了TimezoneInterface::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testToHtml

 public function testToHtml()
 {
     $fieldSet = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Fieldset', [], [], '', false);
     $form = $this->getMock('Magento\\Framework\\Data\\Form', [], [], '', false);
     $attributeModel = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute', [], [], '', false);
     $entityType = $this->getMock('Magento\\Eav\\Model\\Entity\\Type', [], [], '', false);
     $formElement = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Text', ['setDisabled'], [], '', false);
     $directoryReadInterface = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $this->registry->expects($this->any())->method('registry')->with('entity_attribute')->willReturn($attributeModel);
     $this->formFactory->expects($this->any())->method('create')->willReturn($form);
     $form->expects($this->any())->method('addFieldset')->willReturn($fieldSet);
     $form->expects($this->any())->method('getElement')->willReturn($formElement);
     $fieldSet->expects($this->any())->method('addField')->willReturnSelf();
     $attributeModel->expects($this->any())->method('getDefaultValue')->willReturn('default_value');
     $attributeModel->expects($this->any())->method('setDisabled')->willReturnSelf();
     $attributeModel->expects($this->any())->method('getId')->willReturn(1);
     $attributeModel->expects($this->any())->method('getEntityType')->willReturn($entityType);
     $attributeModel->expects($this->any())->method('getIsUserDefined')->willReturn(false);
     $attributeModel->expects($this->any())->method('getAttributeCode')->willReturn('attribute_code');
     $this->localeDate->expects($this->any())->method('getDateFormat')->willReturn('mm/dd/yy');
     $entityType->expects($this->any())->method('getEntityTypeCode')->willReturn('entity_type_code');
     $this->eavData->expects($this->any())->method('getFrontendClasses')->willReturn([]);
     $formElement->expects($this->exactly(3))->method('setDisabled')->willReturnSelf();
     $this->yesNo->expects($this->any())->method('toOptionArray')->willReturn(['yes', 'no']);
     $this->filesystem->expects($this->any())->method('getDirectoryRead')->willReturn($directoryReadInterface);
     $directoryReadInterface->expects($this->any())->method('getRelativePath')->willReturn('relative_path');
     $this->block->setData(['action' => 'save']);
     $this->block->toHtml();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:29,代码来源:AdvancedTest.php

示例2: setupAggregate

 /**
  * Set up aggregate
  *
  * @return \DateTime
  */
 protected function setupAggregate()
 {
     $this->localeResolverMock->expects($this->once())->method('emulate')->with(0);
     $this->localeResolverMock->expects($this->once())->method('revert');
     $date = (new \DateTime())->sub(new \DateInterval('PT25H'));
     $this->localeDateMock->expects($this->once())->method('date')->will($this->returnValue($date));
     return $date;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:AggregateSalesReportBestsellersDataTest.php

示例3: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMockBuilder('Magento\\Framework\\Data\\Collection\\EntityFactory')->disableOriginalConstructor()->getMock();
     $this->timezoneMock = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface')->getMock();
     $this->factoryMock = $this->getMockBuilder('Magento\\Reports\\Model\\ResourceModel\\Report\\Collection\\Factory')->disableOriginalConstructor()->getMock();
     $this->timezoneMock->expects($this->any())->method('formatDateTime')->will($this->returnCallback([$this, 'formatDateTime']));
     $this->collection = new Collection($this->entityFactoryMock, $this->timezoneMock, $this->factoryMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:CollectionTest.php

示例4: setupAggregate

 /**
  * Set up aggregate
  *
  * @return \Magento\Framework\Stdlib\DateTime\DateInterface
  */
 protected function setupAggregate()
 {
     $date = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\Date', ['emulate', 'revert'], [], '', false);
     $this->localeResolverMock->expects($this->once())->method('emulate')->with(0);
     $this->localeResolverMock->expects($this->once())->method('revert');
     $dateMock = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\DateInterface')->disableOriginalConstructor()->getMock();
     $dateMock->expects($this->once())->method('subHour')->with(25)->will($this->returnValue($date));
     $this->localeDateMock->expects($this->once())->method('date')->will($this->returnValue($dateMock));
     return $date;
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:15,代码来源:AggregateSalesReportInvoicedDataTest.php

示例5: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->localeDate = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface')->disableOriginalConstructor()->getMock();
     $this->localeDate->expects($this->once())->method('date')->willReturnArgument(0);
     $this->contextMock = $this->getMockBuilder('Magento\\Backend\\Block\\Context')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->once())->method('getLocaleDate')->willReturn($this->localeDate);
     $this->resolverMock = $this->getMockBuilder('Magento\\Framework\\Locale\\ResolverInterface')->getMock();
     $this->dateTimeFormatter = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateTimeFormatterInterface');
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->date = $objectManager->getObject('Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', ['context' => $this->contextMock, 'localeResolver' => $this->resolverMock, 'dateTimeFormatter' => $this->dateTimeFormatter]);
     $this->globalStateLocaleBackup = \Locale::getDefault();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:DateTest.php

示例6: testRender

 /**
  * @param string $data
  * @param string $index
  * @param string $locale
  * @param string $period
  * @param string $result
  * @dataProvider datesDataProvider
  * @return void
  */
 public function testRender($data, $index, $locale, $period, $result)
 {
     $this->resolverMock->expects($this->any())->method('getLocale')->will($this->returnValue($locale));
     $this->localeDate->expects($this->any())->method('getDateFormat')->willReturnCallback(function ($value) use($locale) {
         return (new \IntlDateFormatter($locale, $value, \IntlDateFormatter::NONE))->getPattern();
     });
     $objectMock = $this->getMockBuilder('Magento\\Framework\\Object')->setMethods(['getData'])->getMock();
     $objectMock->expects($this->once())->method('getData')->will($this->returnValue($data));
     $columnMock = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Grid\\Column')->disableOriginalConstructor()->setMethods(['getIndex', 'getPeriodType'])->getMock();
     $columnMock->expects($this->once())->method('getIndex')->will($this->returnValue($index));
     $columnMock->expects($this->atLeastOnce())->method('getPeriodType')->will($this->returnValue($period));
     $this->date->setColumn($columnMock);
     $this->assertEquals($result, $this->date->render($objectMock));
 }
开发者ID:nja78,项目名称:magento2,代码行数:23,代码来源:DateTest.php

示例7: testGetStoreLastLoginDate

 /**
  * @param string $result
  * @param string|null $lastLoginAt
  * @dataProvider getStoreLastLoginDateDataProvider
  * @return void
  */
 public function testGetStoreLastLoginDate($result, $lastLoginAt)
 {
     $this->customerLog->expects($this->once())->method('getLastLoginAt')->willReturn($lastLoginAt);
     $this->localeDate->expects($this->any())->method('scopeDate')->will($this->returnValue($lastLoginAt));
     $this->localeDate->expects($this->any())->method('formatDateTime')->willReturn($lastLoginAt);
     $this->assertEquals($result, $this->block->getStoreLastLoginDate());
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:13,代码来源:PersonalInfoTest.php

示例8: testRefreshSpecialPrices

 public function testRefreshSpecialPrices()
 {
     $idsToProcess = [1, 2, 3];
     $this->metadataPool->expects($this->atLeastOnce())->method('getMetadata')->willReturn($this->metadataMock);
     $this->metadataMock->expects($this->atLeastOnce())->method('getLinkField')->willReturn('row_id');
     $this->metadataMock->expects($this->atLeastOnce())->method('getIdentifierField')->willReturn('entity_id');
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $selectMock->expects($this->any())->method('from')->will($this->returnSelf());
     $selectMock->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $selectMock->expects($this->any())->method('where')->will($this->returnSelf());
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], [], '', false);
     $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock));
     $connectionMock->expects($this->any())->method('fetchCol')->will($this->returnValue($idsToProcess));
     $this->_resourceMock->expects($this->once())->method('getConnection')->will($this->returnValue($connectionMock));
     $this->_resourceMock->expects($this->any())->method('getTableName')->will($this->returnValue('category'));
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->_storeManagerMock->expects($this->once())->method('getStores')->with(true)->will($this->returnValue([$storeMock]));
     $this->_localeDateMock->expects($this->once())->method('scopeTimeStamp')->with($storeMock)->will($this->returnValue(32000));
     $indexerMock = $this->getMock('Magento\\Indexer\\Model\\Indexer', [], [], '', false);
     $indexerMock->expects($this->exactly(2))->method('reindexList');
     $this->_priceProcessorMock->expects($this->exactly(2))->method('getIndexer')->will($this->returnValue($indexerMock));
     $attributeMock = $this->getMockForAbstractClass('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute', [], '', false, true, true, ['__wakeup', 'getAttributeId']);
     $attributeMock->expects($this->any())->method('getAttributeId')->will($this->returnValue(1));
     $this->_eavConfigMock->expects($this->any())->method('getAttribute')->will($this->returnValue($attributeMock));
     $this->_model->execute();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:27,代码来源:RefreshSpecialPricesTest.php

示例9: setUp

 /**
  * Prepare parameters
  */
 public function setUp()
 {
     $this->_objectManager = $this->getMockBuilder('Magento\\Framework\\App\\ObjectManager')->disableOriginalConstructor()->getMock();
     $this->_cache = $this->getMock('Magento\\Framework\\App\\CacheInterface');
     $this->_config = $this->getMockBuilder('Magento\\Cron\\Model\\Config')->disableOriginalConstructor()->getMock();
     $this->_scopeConfig = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->disableOriginalConstructor()->getMock();
     $this->_collection = $this->getMockBuilder('Magento\\Cron\\Model\\Resource\\Schedule\\Collection')->setMethods(['addFieldToFilter', 'load', '__wakeup'])->disableOriginalConstructor()->getMock();
     $this->_collection->expects($this->any())->method('addFieldToFilter')->will($this->returnSelf());
     $this->_collection->expects($this->any())->method('load')->will($this->returnSelf());
     $this->_scheduleFactory = $this->getMockBuilder('Magento\\Cron\\Model\\ScheduleFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->_request = $this->getMockBuilder('Magento\\Framework\\App\\Console\\Request')->disableOriginalConstructor()->getMock();
     $this->_shell = $this->getMockBuilder('Magento\\Framework\\ShellInterface')->disableOriginalConstructor()->setMethods(['execute'])->getMock();
     $this->timezone = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->timezone->expects($this->any())->method('scopeTimeStamp')->will($this->returnValue(time()));
     $this->_observer = new \Magento\Cron\Model\Observer($this->_objectManager, $this->_scheduleFactory, $this->_cache, $this->_config, $this->_scopeConfig, $this->_request, $this->_shell, $this->timezone);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:ObserverTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->jsonHelper = $this->getMock('\\Magento\\Framework\\Json\\Helper\\Data', [], [], '', false);
     $this->importExportData = $this->getMock('\\Magento\\ImportExport\\Helper\\Data', [], [], '', false);
     $this->resourceHelper = $this->getMock('\\Magento\\ImportExport\\Model\\ResourceModel\\Helper', [], [], '', false);
     $this->resource = $this->getMock('\\Magento\\Framework\\App\\ResourceConnection', ['getConnection'], [], '', false);
     $this->connection = $this->getMockForAbstractClass('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->dataSourceModel = $this->getMock('\\Magento\\ImportExport\\Model\\ResourceModel\\Import\\Data', [], [], '', false);
     $this->eavConfig = $this->getMock('\\Magento\\Eav\\Model\\Config', [], [], '', false);
     $entityType = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Type', [], [], '', false);
     $entityType->method('getEntityTypeId')->willReturn('');
     $this->eavConfig->method('getEntityType')->willReturn($entityType);
     $this->resourceFactory = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Proxy\\Product\\ResourceModelFactory', ['create', 'getTable'], [], '', false);
     $this->resourceFactory->expects($this->any())->method('create')->willReturnSelf();
     $this->resourceFactory->expects($this->any())->method('getTable')->willReturnSelf();
     $this->catalogData = $this->getMock('\\Magento\\Catalog\\Helper\\Data', [], [], '', false);
     $this->storeResolver = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product\\StoreResolver', [], [], '', false);
     $this->importProduct = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product', [], [], '', false);
     $this->productModel = $this->getMock('\\Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->validator = $this->getMock('\\Magento\\AdvancedPricingImportExport\\Model\\Import\\AdvancedPricing\\Validator', ['isValid', 'getMessages'], [], '', false);
     $this->websiteValidator = $this->getMock('\\Magento\\AdvancedPricingImportExport\\Model\\Import\\AdvancedPricing\\Validator\\Website', [], [], '', false);
     $this->tierPriceValidator = $this->getMock('\\Magento\\AdvancedPricingImportExport\\Model\\Import\\AdvancedPricing\\Validator\\TierPrice', [], [], '', false);
     $this->stringObject = $this->getMock('\\Magento\\Framework\\Stdlib\\StringUtils', [], [], '', false);
     $this->errorAggregator = $this->getErrorAggregatorObject();
     $this->dateTime = $this->getMock('\\Magento\\Framework\\Stdlib\\DateTime\\DateTime', ['date', 'format'], [], '', false);
     $this->dateTime->expects($this->any())->method('date')->willReturnSelf();
     $this->advancedPricing = $this->getAdvancedPricingMock(['retrieveOldSkus', 'validateRow', 'addRowError', 'saveProductPrices', 'getCustomerGroupId', 'getWebSiteId', 'deleteProductTierPrices', 'getBehavior', 'saveAndReplaceAdvancedPrices', 'processCountExistingPrices', 'processCountNewPrices']);
     $this->advancedPricing->expects($this->any())->method('retrieveOldSkus')->willReturn([]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:31,代码来源:AdvancedPricingTest.php

示例11: testGetCcExpDate

 /**
  * @dataProvider getCcExpDateDataProvider
  */
 public function testGetCcExpDate($ccExpMonth, $ccExpYear)
 {
     $paymentInfo = $this->getMock('Magento\\Payment\\Model\\Info', ['getCcExpMonth', 'getCcExpYear'], [], '', false);
     $paymentInfo->expects($this->any())->method('getCcExpMonth')->will($this->returnValue($ccExpMonth));
     $paymentInfo->expects($this->any())->method('getCcExpYear')->will($this->returnValue($ccExpYear));
     $this->model->setData('info', $paymentInfo);
     $this->localeDate->expects($this->exactly(2))->method('getConfigTimezone')->willReturn('America/Los_Angeles');
     $this->assertEquals($ccExpYear, $this->model->getCcExpDate()->format('Y'));
     $this->assertEquals($ccExpMonth, $this->model->getCcExpDate()->format('m'));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:CcTest.php

示例12: testLoadChangeFromCache

 /**
  * @test
  * @return void
  * @covers \Magento\Theme\Model\Design::loadChange
  * @covers \Magento\Theme\Model\Design::__construct
  * @covers \Magento\Theme\Model\Design::_construct
  */
 public function testLoadChangeFromCache()
 {
     $storeId = 1;
     $localDate = '2\\28\\2000';
     $date = '28-02-2000';
     $cacheId = 'design_change_' . md5($storeId . $date);
     $this->localeDate->expects($this->once())->method('scopeTimeStamp')->with($storeId)->willReturn($localDate);
     $this->dateTime->expects($this->once())->method('formatDate')->with($localDate, false)->willReturn($date);
     $this->cacheManager->expects($this->once())->method('load')->with($cacheId)->willReturn(serialize(['test' => 'data']));
     $this->assertInstanceOf(get_class($this->model), $this->model->loadChange($storeId));
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:DesignTest.php

示例13: setUp

 /**
  * Prepare parameters
  */
 protected function setUp()
 {
     $this->_objectManager = $this->getMockBuilder('Magento\\Framework\\App\\ObjectManager')->disableOriginalConstructor()->getMock();
     $this->_cache = $this->getMock('Magento\\Framework\\App\\CacheInterface');
     $this->_config = $this->getMockBuilder('Magento\\Cron\\Model\\Config')->disableOriginalConstructor()->getMock();
     $this->_scopeConfig = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->disableOriginalConstructor()->getMock();
     $this->_collection = $this->getMockBuilder('Magento\\Cron\\Model\\ResourceModel\\Schedule\\Collection')->setMethods(['addFieldToFilter', 'load', '__wakeup'])->disableOriginalConstructor()->getMock();
     $this->_collection->expects($this->any())->method('addFieldToFilter')->will($this->returnSelf());
     $this->_collection->expects($this->any())->method('load')->will($this->returnSelf());
     $this->_scheduleFactory = $this->getMockBuilder('Magento\\Cron\\Model\\ScheduleFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->_request = $this->getMockBuilder('Magento\\Framework\\App\\Console\\Request')->disableOriginalConstructor()->getMock();
     $this->_shell = $this->getMockBuilder('Magento\\Framework\\ShellInterface')->disableOriginalConstructor()->setMethods(['execute'])->getMock();
     $this->observer = $this->getMock('Magento\\Framework\\Event\\Observer', [], [], '', false);
     $this->timezone = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->timezone->expects($this->any())->method('scopeTimeStamp')->will($this->returnValue(time()));
     $phpExecutableFinder = $this->getMock('Symfony\\Component\\Process\\PhpExecutableFinder', [], [], '', false);
     $phpExecutableFinder->expects($this->any())->method('find')->willReturn('php');
     $phpExecutableFinderFactory = $this->getMock('Magento\\Framework\\Process\\PhpExecutableFinderFactory', [], [], '', false);
     $phpExecutableFinderFactory->expects($this->any())->method('create')->willReturn($phpExecutableFinder);
     $this->_observer = new ProcessCronQueueObserver($this->_objectManager, $this->_scheduleFactory, $this->_cache, $this->_config, $this->_scopeConfig, $this->_request, $this->_shell, $this->timezone, $phpExecutableFinderFactory);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:24,代码来源:ProcessCronQueueObserverTest.php

示例14: testGetHtmlSuccessfulTimestamp

 public function testGetHtmlSuccessfulTimestamp()
 {
     $uniqueHash = 'H@$H';
     $id = 3;
     $format = 'mm/dd/yyyy';
     $yesterday = new \DateTime();
     $yesterday->add(\DateInterval::createFromDateString('yesterday'));
     $tomorrow = new \DateTime();
     $tomorrow->add(\DateInterval::createFromDateString('tomorrow'));
     $value = ['locale' => 'en_US', 'from' => $yesterday->getTimestamp(), 'to' => $tomorrow->getTimestamp()];
     $this->mathRandomMock->expects($this->any())->method('getUniqueHash')->willReturn($uniqueHash);
     $this->columnMock->expects($this->once())->method('getHtmlId')->willReturn($id);
     $this->localeDateMock->expects($this->any())->method('getDateFormat')->willReturn($format);
     $this->columnMock->expects($this->any())->method('getTimezone')->willReturn(false);
     $this->localeResolverMock->expects($this->any())->method('getLocale')->willReturn('en_US');
     $this->model->setColumn($this->columnMock);
     $this->model->setValue($value);
     $output = $this->model->getHtml();
     $this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
     $this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:21,代码来源:DateTest.php

示例15: testRefreshSpecialPrices

 public function testRefreshSpecialPrices()
 {
     $idsToProcess = array(1, 2, 3);
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', array(), array(), '', false);
     $selectMock->expects($this->any())->method('from')->will($this->returnSelf());
     $selectMock->expects($this->any())->method('where')->will($this->returnSelf());
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface', array(), array(), '', false);
     $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock));
     $connectionMock->expects($this->any())->method('fetchCol')->with($selectMock, array('entity_id'))->will($this->returnValue($idsToProcess));
     $this->_resourceMock->expects($this->once())->method('getConnection')->with('write')->will($this->returnValue($connectionMock));
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', array(), array(), '', false);
     $storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->_storeManagerMock->expects($this->once())->method('getStores')->with(true)->will($this->returnValue(array($storeMock)));
     $this->_localeDateMock->expects($this->once())->method('scopeTimeStamp')->with($storeMock)->will($this->returnValue(32000));
     $indexerMock = $this->getMock('Magento\\Indexer\\Model\\Indexer', array(), array(), '', false);
     $indexerMock->expects($this->exactly(2))->method('reindexList');
     $this->_priceProcessorMock->expects($this->exactly(2))->method('getIndexer')->will($this->returnValue($indexerMock));
     $attributeMock = $this->getMockForAbstractClass('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute', array(), '', false, true, true, array('__wakeup', 'getAttributeId'));
     $attributeMock->expects($this->any())->method('getAttributeId')->will($this->returnValue(1));
     $this->_eavConfigMock->expects($this->any())->method('getAttribute')->will($this->returnValue($attributeMock));
     $this->_model->refreshSpecialPrices();
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:22,代码来源:ObserverTest.php


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