當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。