/**
  * @dataProvider loadProvider
  * @param mixed $expected
  * @param string $id
  * @param mixed $cache
  * @param bool $isGet
  * @param bool $isHead
  */
 public function testLoad($expected, $id, $cache, $isGet, $isHead)
 {
     $this->requestMock->expects($this->once())->method('isGet')->will($this->returnValue($isGet));
     $this->requestMock->expects($this->any())->method('isHead')->will($this->returnValue($isHead));
     $this->fullPageCacheMock->expects($this->any())->method('load')->with($this->equalTo($id))->will($this->returnValue(serialize($cache)));
     $this->identifierMock->expects($this->any())->method('getValue')->will($this->returnValue($id));
     $this->assertEquals($expected, $this->kernel->load());
 }
 /**
  * Modify and cache application response
  *
  * @param \Magento\Framework\App\Response\Http $response
  * @return void
  */
 public function process(\Magento\Framework\App\Response\Http $response)
 {
     if (preg_match('/public.*s-maxage=(\\d+)/', $response->getHeader('Cache-Control')->getFieldValue(), $matches)) {
         $maxAge = $matches[1];
         $response->setNoCacheHeaders();
         if (($response->getHttpResponseCode() == 200 || $response->getHttpResponseCode() == 404) && ($this->request->isGet() || $this->request->isHead())) {
             $tagsHeader = $response->getHeader('X-Magento-Tags');
             $tags = $tagsHeader ? explode(',', $tagsHeader->getFieldValue()) : [];
             $response->clearHeader('Set-Cookie');
             $response->clearHeader('X-Magento-Tags');
             if (!headers_sent()) {
                 header_remove('Set-Cookie');
             }
             $this->getCache()->save(serialize($response), $this->identifier->getValue(), $tags, $maxAge);
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getValue()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getValue');
     if (!$pluginInfo) {
         return parent::getValue();
     } else {
         return $this->___callPlugins('getValue', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @param $cookieExists
  *
  * @dataProvider trueFalseDataProvider
  */
 public function testVaryStringSource($cookieExists)
 {
     $this->requestMock->method('get')->willReturn($cookieExists ? 'vary-string-from-cookie' : null);
     $this->contextMock->expects($cookieExists ? $this->never() : $this->once())->method('getVaryString');
     $this->model->getValue();
 }