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


PHP FrontendInterface::expects方法代码示例

本文整理汇总了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);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:13,代码来源:ConfigTest.php

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

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

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

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


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