本文整理汇总了PHP中Magento\Framework\Cache\FrontendInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendInterface::expects方法的具体用法?PHP FrontendInterface::expects怎么用?PHP FrontendInterface::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Cache\FrontendInterface
的用法示例。
在下文中一共展示了FrontendInterface::expects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCleanModeMatchingAnyTag
/**
* @param bool $fixtureResultOne
* @param bool $fixtureResultTwo
* @param bool $expectedResult
* @dataProvider cleanModeMatchingAnyTagDataProvider
*/
public function testCleanModeMatchingAnyTag($fixtureResultOne, $fixtureResultTwo, $expectedResult)
{
$this->frontendMock->expects($this->at(0))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_one', \Magento\Framework\App\Cache\Type\Config::CACHE_TAG])->will($this->returnValue($fixtureResultOne));
$this->frontendMock->expects($this->at(1))->method('clean')->with(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['test_tag_two', \Magento\Framework\App\Cache\Type\Config::CACHE_TAG])->will($this->returnValue($fixtureResultTwo));
$actualResult = $this->model->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ['test_tag_one', 'test_tag_two']);
$this->assertEquals($expectedResult, $actualResult);
}
示例2: testGetData
/**
* @param $data
* @param $result
* @dataProvider dataProviderForTestGetData
*/
public function testGetData($data, $result)
{
$this->cache->expects($this->once())->method('load')->will($this->returnValue(serialize($data)));
$this->expectsSetConfig('themeId');
$this->translate->loadData('frontend');
$this->assertEquals($result, $this->translate->getData());
}
示例3: testGenerateElementsWithCache
public function testGenerateElementsWithCache()
{
$layoutCacheId = 'layout_cache_id';
/** @var \Magento\Framework\View\Layout\Element $xml */
$xml = simplexml_load_string('<layout/>', 'Magento\Framework\View\Layout\Element');
$this->model->setXml($xml);
$themeMock = $this->getMockForAbstractClass('Magento\Framework\View\Design\ThemeInterface');
$this->themeResolverMock->expects($this->once())
->method('get')
->willReturn($themeMock);
$this->processorFactoryMock->expects($this->once())
->method('create')
->with(['theme' => $themeMock])
->willReturn($this->processorMock);
$this->processorMock->expects($this->once())
->method('getCacheId')
->willReturn($layoutCacheId);
$readerContextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Context')
->disableOriginalConstructor()
->getMock();
$this->cacheMock->expects($this->once())
->method('load')
->with('structure_' . $layoutCacheId)
->willReturn(serialize($readerContextMock));
$this->readerPoolMock->expects($this->never())
->method('interpret');
$this->cacheMock->expects($this->never())
->method('save');
$generatorContextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Generator\Context')
->disableOriginalConstructor()
->getMock();
$this->generatorContextFactoryMock->expects($this->once())
->method('create')
->with(['structure' => $this->structureMock, 'layout' => $this->model])
->willReturn($generatorContextMock);
$this->generatorPoolMock->expects($this->once())
->method('process')
->with($readerContextMock, $generatorContextMock)
->willReturn(true);
$elements = [
'name_1' => ['type' => '', 'parent' => null],
'name_2' => ['type' => \Magento\Framework\View\Layout\Element::TYPE_CONTAINER, 'parent' => null],
'name_3' => ['type' => '', 'parent' => 'parent'],
'name_4' => ['type' => \Magento\Framework\View\Layout\Element::TYPE_CONTAINER, 'parent' => 'parent'],
];
$this->structureMock->expects($this->once())
->method('exportElements')
->willReturn($elements);
$this->model->generateElements();
}
示例4: testPersist
public function testPersist()
{
$cacheTypes = array('cache_type' => false);
$model = $this->_buildModel($cacheTypes);
$this->_resource->expects($this->once())->method('saveAllOptions')->with($cacheTypes);
$this->_cacheFrontend->expects($this->once())->method('remove')->with(\Magento\Framework\App\Cache\State::CACHE_ID);
$model->persist();
}
示例5: testClean
public function testClean()
{
$this->_cache->expects(
$this->once()
)->method(
'clean'
)->with(
\Zend_Cache::CLEANING_MODE_MATCHING_TAG,
[\Magento\Framework\App\Config\ScopePool::CACHE_TAG]
);
$this->_object->clean('testScope');
}