本文整理汇总了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();
}