Ejemplo n.º 1
0
 public function testSendVaryEmptyData()
 {
     $this->contextMock->expects($this->once())->method('getVaryString')->willReturn(null);
     $this->cookieMetadataFactoryMock->expects($this->never())->method('createSensitiveCookieMetadata');
     $this->requestMock->expects($this->once())->method('get')->willReturn(null);
     $this->model->sendVary();
 }
Ejemplo n.º 2
0
 public function testSendVaryEmptyData()
 {
     $expectedCookieName = Http::COOKIE_VARY_STRING;
     $cookieMetadataMock = $this->getMock('Magento\\Framework\\Stdlib\\Cookie\\CookieMetadata');
     $cookieMetadataMock->expects($this->once())->method('setPath')->with('/')->will($this->returnSelf());
     $this->cookieMetadataFactoryMock->expects($this->once())->method('createCookieMetadata')->with()->will($this->returnValue($cookieMetadataMock));
     $this->cookieManagerMock->expects($this->once())->method('deleteCookie')->with($expectedCookieName, $cookieMetadataMock);
     $this->model->sendVary();
 }
Ejemplo n.º 3
0
 /**
  * Set proper value of X-Magento-Vary cookie.
  *
  * @param \Magento\Framework\App\Response\Http $subject
  * @return void
  */
 public function beforeSendResponse(\Magento\Framework\App\Response\Http $subject)
 {
     if ($subject instanceof \Magento\Framework\App\PageCache\NotCacheableInterface) {
         return;
     }
     $subject->sendVary();
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function sendVary()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'sendVary');
     if (!$pluginInfo) {
         return parent::sendVary();
     } else {
         return $this->___callPlugins('sendVary', func_get_args(), $pluginInfo);
     }
 }
Ejemplo n.º 5
0
 public function testSendVaryEmptyData()
 {
     $this->_cookieMock->expects($this->once())->method('set')->with(Http::COOKIE_VARY_STRING, null, -1, '/');
     $this->_model->sendVary();
 }
Ejemplo n.º 6
0
 /**
  * Set proper value of X-Magento-Vary cookie.
  *
  * @param \Magento\Framework\App\Response\Http $subject
  * @return void
  */
 public function beforeSendResponse(\Magento\Framework\App\Response\Http $subject)
 {
     $subject->sendVary();
 }