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


PHP Cache::expects方法代码示例

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


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

示例1: testGet

 /**
  * @dataProvider getProvider
  *
  * @param mixed $cachedData
  * @param array $resultExpected
  * @param bool  $fetchExpected
  * @param array $fetchedResult
  * @param bool  $isException
  */
 public function testGet($cachedData, $resultExpected, $fetchExpected, $fetchedResult = [], $isException = false)
 {
     $this->cache->expects($this->once())->method('fetch')->with($this->equalTo(TranslationStatisticProvider::CACHE_KEY))->will($this->returnValue($cachedData));
     if ($fetchExpected) {
         if ($isException) {
             $this->adapter->expects($this->once())->method('fetchStatistic')->will($this->throwException($fetchedResult));
         } else {
             $this->adapter->expects($this->once())->method('fetchStatistic')->will($this->returnValue($fetchedResult));
         }
         $this->cache->expects($this->once())->method('save')->with($this->equalTo(TranslationStatisticProvider::CACHE_KEY));
     } else {
         $this->adapter->expects($this->never())->method('fetchStatistic');
     }
     $result = $this->provider->get();
     $this->assertSame($resultExpected, $result);
 }
开发者ID:Maksold,项目名称:platform,代码行数:25,代码来源:TranslationStatisticProviderTest.php

示例2: testClearDeletesAllIfFlushableAndClearable

 public function testClearDeletesAllIfFlushableAndClearable()
 {
     $this->cache = $this->getMock('Webmozart\\KeyValueStore\\Tests\\Fixtures\\TestClearableFlushableCache');
     $this->decorator = new CachingDecorator($this->innerStore, $this->cache);
     $this->innerStore->expects($this->once())->method('clear');
     $this->cache->expects($this->once())->method('deleteAll');
     $this->decorator->clear();
 }
开发者ID:webmozart,项目名称:key-value-store,代码行数:8,代码来源:CachingDecoratorTest.php

示例3: testAssignCacheIdToTagWithDuplicatedCacheId

 /**
  * @group assignCacheIdToTag
  */
 public function testAssignCacheIdToTagWithDuplicatedCacheId()
 {
     $this->mockCache->expects($this->once())->method('fetch')->with('__advcache_tag[tag1]')->will($this->returnValue(array('testcacheid2', 'testcacheid1')));
     $this->mockCache->expects($this->once())->method('save')->with('__advcache_tag[tag1]', array('testcacheid2', 'testcacheid1'));
     $this->getTestObject()->assignCacheIdToTag('testcacheid2', 'tag1');
 }
开发者ID:ceikermann,项目名称:advcache,代码行数:9,代码来源:AdvCacheTest.php

示例4: testOffsetUnset

 public function testOffsetUnset()
 {
     $this->cache->expects($this->once())->method('delete')->with($this->identicalTo($offset = 'foo'));
     unset($this->doctrineCacheStorage[$offset]);
 }
开发者ID:blazarecki,项目名称:lug,代码行数:5,代码来源:DoctrineStorageTest.php


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