20 private $moduleManagerMock;
25 private $cacheConfigMock;
29 $this->requestMock = $this->createMock(\
Magento\Framework\
App\Request\Http::class);
30 $this->moduleManagerMock = $this->createMock(\
Magento\Framework\Module\Manager::class);
31 $this->cacheConfigMock = $this->createMock(\
Magento\PageCache\Model\Config::class);
49 $this->requestMock->expects($this->any())->method(
'isAjax')->willReturn($requestResult[
'ajax']);
50 $this->requestMock->expects($this->any())->method(
'isGet')->willReturn($requestResult[
'get']);
51 $this->requestMock->expects($this->any())->method(
'isHead')->willReturn($requestResult[
'head']);
52 $this->moduleManagerMock
53 ->expects($this->any())
55 ->with(
'Magento_PageCache')
56 ->willReturn($moduleManagerResult);
58 $this->cacheConfigMock->expects($this->any())->method(
'isEnabled')->willReturn($cacheConfigResult);
59 $layoutMock = $this->getMockForAbstractClass(\
Magento\Framework\View\LayoutInterface::class, [],
'',
false);
60 $layoutMock->expects($this->any())->method(
'isCacheable')->willReturn($layoutResult);
62 $object =
new DepersonalizeChecker($this->requestMock, $this->moduleManagerMock, $this->cacheConfigMock);
63 $this->assertEquals($canDepersonalize, $object->checkIfDepersonalize($layoutMock));
72 [[
'ajax' =>
false,
'get' =>
true,
'head' =>
false],
true,
true,
true,
true],
73 [[
'ajax' =>
false,
'get' =>
false,
'head' =>
true],
true,
true,
true,
true],
74 [[
'ajax' =>
false,
'get' =>
false,
'head' =>
false],
true,
true,
true,
false],
75 [[
'ajax' =>
true,
'get' =>
true,
'head' =>
false],
true,
true,
true,
false],
76 [[
'ajax' =>
false,
'get' =>
true,
'head' =>
false],
false,
true,
true,
false],
77 [[
'ajax' =>
false,
'get' =>
true,
'head' =>
false],
true,
false,
true,
false],
78 [[
'ajax' =>
false,
'get' =>
true,
'head' =>
false],
true,
true,
false,
false],
testCheckIfDepersonalize(array $requestResult, $moduleManagerResult, $cacheConfigResult, $layoutResult, $canDepersonalize)
checkIfDepersonalizeDataProvider()