41 $this->designExceptionsMock = $this->createPartialMock(
42 \
Magento\Framework\View\DesignExceptions::class,
45 $this->requestMock = $this->createMock(\
Magento\Framework\
App\Request\Http::class);
46 $this->pageCacheConfigMock = $this->createPartialMock(
47 \
Magento\PageCache\Model\Config::class,
48 [
'getType',
'isEnabled']
51 $this->plugin = new \Magento\PageCache\Model\App\CacheIdentifierPlugin(
52 $this->designExceptionsMock,
54 $this->pageCacheConfigMock
70 $identifierMock = $this->createMock(\
Magento\Framework\
App\PageCache\Identifier::class);
72 $this->pageCacheConfigMock->expects($this->once())
74 ->will($this->returnValue($cacheType));
75 $this->pageCacheConfigMock->expects($this->any())
77 ->will($this->returnValue($isPageCacheEnabled));
78 $this->designExceptionsMock->expects($this->any())
79 ->method(
'getThemeByRequest')
80 ->will($this->returnValue($uaException));
82 $this->assertEquals($expected, $this->plugin->afterGetValue($identifierMock,
$result));
93 'Varnish + PageCache enabled' => [
Config::VARNISH,
true,
null,
false,
false],
94 'Built-in + PageCache disabled' => [
Config::BUILT_IN,
false,
null,
false,
false],
95 'Built-in + PageCache enabled' => [
Config::BUILT_IN,
true,
null,
false,
false],
96 'Built-in, PageCache enabled, no user-agent exceptions' =>
98 'Built-in, PageCache enabled, with design exception' => [
Config::BUILT_IN,
true,
'aa123aa',
'7',
'7aa123aa']
testAfterGetValue($cacheType, $isPageCacheEnabled, $result, $uaException, $expected)
afterGetValueDataProvider()