本文整理匯總了PHP中Magento\Framework\App\Response\Http::sendVary方法的典型用法代碼示例。如果您正苦於以下問題:PHP Http::sendVary方法的具體用法?PHP Http::sendVary怎麽用?PHP Http::sendVary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\App\Response\Http
的用法示例。
在下文中一共展示了Http::sendVary方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSendVaryEmptyData
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();
}
示例2: testSendVaryEmptyData
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();
}
示例3: beforeSendResponse
/**
* 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();
}
示例4: 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);
}
}
示例5: testSendVaryEmptyData
public function testSendVaryEmptyData()
{
$this->_cookieMock->expects($this->once())->method('set')->with(Http::COOKIE_VARY_STRING, null, -1, '/');
$this->_model->sendVary();
}
示例6: beforeSendResponse
/**
* 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();
}