コード例 #1
0
 public function testExecuteWithEmptyTags()
 {
     $this->_configMock->expects($this->any())->method('isEnabled')->will($this->returnValue(true));
     $observerObject = $this->getMock('Magento\\Framework\\Event\\Observer');
     $observedObject = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $tags = [];
     $eventMock = $this->getMock('Magento\\Framework\\Event', ['getObject'], [], '', false);
     $eventMock->expects($this->once())->method('getObject')->will($this->returnValue($observedObject));
     $observerObject->expects($this->once())->method('getEvent')->will($this->returnValue($eventMock));
     $this->_configMock->expects($this->once())->method('getType')->will($this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN));
     $observedObject->expects($this->once())->method('getIdentities')->will($this->returnValue($tags));
     $this->fullPageCacheMock->expects($this->never())->method('clean');
     $this->_model->execute($observerObject);
 }
コード例 #2
0
 /**
  * @dataProvider processNotSaveCacheProvider
  * @param string $cacheControlHeader
  * @param int $httpCode
  * @param bool $isGet
  * @param bool $overrideHeaders
  */
 public function testProcessNotSaveCache($cacheControlHeader, $httpCode, $isGet, $overrideHeaders)
 {
     $header = \Zend\Http\Header\CacheControl::fromString("Cache-Control: {$cacheControlHeader}");
     $this->responseMock->expects($this->once())->method('getHeader')->with('Cache-Control')->will($this->returnValue($header));
     $this->responseMock->expects($this->any())->method('getHttpResponseCode')->will($this->returnValue($httpCode));
     $this->requestMock->expects($this->any())->method('isGet')->will($this->returnValue($isGet));
     if ($overrideHeaders) {
         $this->responseMock->expects($this->once())->method('setNoCacheHeaders');
     }
     $this->fullPageCacheMock->expects($this->never())->method('save');
     $this->kernel->process($this->responseMock);
 }
コード例 #3
0
 public function testClean()
 {
     $this->eventManagerMock->expects($this->once())->method('dispatch')->with('adminhtml_cache_refresh_type');
     $this->model->clean();
 }
コード例 #4
0
 /**
  * Test case for flushing all the cache
  */
 public function testExecute()
 {
     $this->_configMock->expects($this->once())->method('getType')->will($this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN));
     $this->fullPageCacheMock->expects($this->once())->method('clean');
     $this->_model->execute($this->observerMock);
 }