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(); }
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(); }
/** * 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(); }
/** * {@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); } }
public function testSendVaryEmptyData() { $this->_cookieMock->expects($this->once())->method('set')->with(Http::COOKIE_VARY_STRING, null, -1, '/'); $this->_model->sendVary(); }
/** * 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(); }