Skip to content

Commit ad9f69b

Browse files
committed
MC-31729: Non-cacheable block added to default handle makes every page non-cacheable
1 parent 075b14b commit ad9f69b

File tree

16 files changed

+41
-38
lines changed

16 files changed

+41
-38
lines changed

app/code/Magento/Catalog/Model/Layout/DepersonalizePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
}
4242

4343
/**
44-
* Changes sensitive customer data if the depersonalization is needed.
44+
* Change sensitive customer data if the depersonalization is needed.
4545
*
4646
* @param LayoutInterface $subject
4747
* @return void

app/code/Magento/Catalog/Test/Unit/Model/Layout/DepersonalizePluginTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function setUp()
5959
}
6060

6161
/**
62-
* Tests afterGenerateElements method when depersonalization is needed.
62+
* Test afterGenerateElements method when depersonalization is needed.
6363
*
6464
* @return void
6565
*/
@@ -71,7 +71,7 @@ public function testAfterGenerateElements(): void
7171
}
7272

7373
/**
74-
* Tests afterGenerateElements method when depersonalization is not needed.
74+
* Test afterGenerateElements method when depersonalization is not needed.
7575
*
7676
* @return void
7777
*/

app/code/Magento/Checkout/Model/Layout/DepersonalizePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
}
4343

4444
/**
45-
* Changes sensitive customer data if the depersonalization is needed.
45+
* Change sensitive customer data if the depersonalization is needed.
4646
*
4747
* @param LayoutInterface $subject
4848
* @return void

app/code/Magento/Checkout/Test/Unit/Model/Layout/DepersonalizePluginTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function setUp()
5959
}
6060

6161
/**
62-
* Tests afterGenerateElements method when depersonalization is needed.
62+
* Test afterGenerateElements method when depersonalization is needed.
6363
*
6464
* @return void
6565
*/
@@ -75,7 +75,7 @@ public function testAfterGenerateElements(): void
7575
}
7676

7777
/**
78-
* Tests afterGenerateElements method when depersonalization is not needed.
78+
* Test afterGenerateElements method when depersonalization is not needed.
7979
*
8080
* @return void
8181
*/

app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(
7979
}
8080

8181
/**
82-
* Retrieves sensitive customer data.
82+
* Retrieve sensitive customer data.
8383
*
8484
* @param LayoutInterface $subject
8585
* @return void
@@ -93,7 +93,7 @@ public function beforeGenerateXml(LayoutInterface $subject)
9393
}
9494

9595
/**
96-
* Changes sensitive customer data if the depersonalization is needed.
96+
* Change sensitive customer data if the depersonalization is needed.
9797
*
9898
* @param LayoutInterface $subject
9999
* @return void

app/code/Magento/Customer/Test/Unit/Model/Layout/DepersonalizePluginTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function setUp()
105105
}
106106

107107
/**
108-
* Tests beforeGenerateXml method when depersonalization is needed.
108+
* Test beforeGenerateXml method when depersonalization is needed.
109109
*
110110
* @return void
111111
*/
@@ -121,7 +121,7 @@ public function testBeforeGenerateXml(): void
121121
}
122122

123123
/**
124-
* Tests beforeGenerateXml method when depersonalization is not needed.
124+
* Test beforeGenerateXml method when depersonalization is not needed.
125125
*
126126
* @return void
127127
*/
@@ -136,7 +136,7 @@ public function testBeforeGenerateXmlNoDepersonalize(): void
136136
}
137137

138138
/**
139-
* Tests afterGenerateElements method when depersonalization is needed.
139+
* Test afterGenerateElements method when depersonalization is needed.
140140
*
141141
* @return void
142142
*/
@@ -168,7 +168,7 @@ public function testAfterGenerateElements(): void
168168
}
169169

170170
/**
171-
* Tests afterGenerateElements method when depersonalization is not needed.
171+
* Test afterGenerateElements method when depersonalization is not needed.
172172
*
173173
* @return void
174174
*/

app/code/Magento/PageCache/Model/Layout/DepersonalizePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
}
5151

5252
/**
53-
* Changes sensitive customer data if the depersonalization is needed.
53+
* Change sensitive customer data if the depersonalization is needed.
5454
*
5555
* @param LayoutInterface $subject
5656
* @return void

app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
use Magento\Framework\App\MaintenanceMode;
1111
use Magento\Framework\App\ResponseInterface;
1212
use Magento\Framework\DataObject\IdentityInterface;
13-
use Magento\Framework\View\LayoutInterface;
13+
use Magento\Framework\View\Layout;
1414
use Magento\PageCache\Model\Config;
1515

1616
/**
17-
* Appends cacheable pages response headers.
17+
* Append cacheable pages response headers.
1818
*/
1919
class LayoutPlugin
2020
{
@@ -49,28 +49,28 @@ public function __construct(
4949
}
5050

5151
/**
52-
* Sets appropriate Cache-Control headers.
52+
* Set appropriate Cache-Control headers.
5353
*
5454
* We have to set public headers in order to tell Varnish and Builtin app that page should be cached
5555
*
56-
* @param LayoutInterface $subject
56+
* @param Layout $subject
5757
* @return void
5858
*/
59-
public function afterGenerateElements(LayoutInterface $subject)
59+
public function afterGenerateElements(Layout $subject)
6060
{
6161
if ($subject->isCacheable() && !$this->maintenanceMode->isOn() && $this->config->isEnabled()) {
6262
$this->response->setPublicHeaders($this->config->getTtl());
6363
}
6464
}
6565

6666
/**
67-
* Retrieves all identities from blocks for further cache invalidation.
67+
* Retrieve all identities from blocks for further cache invalidation.
6868
*
69-
* @param LayoutInterface $subject
69+
* @param Layout $subject
7070
* @param mixed $result
7171
* @return mixed
7272
*/
73-
public function afterGetOutput(LayoutInterface $subject, $result)
73+
public function afterGetOutput(Layout $subject, $result)
7474
{
7575
if ($subject->isCacheable() && $this->config->isEnabled()) {
7676
$tags = [[]];

app/code/Magento/PageCache/Test/Unit/Model/Layout/DepersonalizePluginTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function setUp()
6969
}
7070

7171
/**
72-
* Tests afterGenerateElements method when depersonalization is needed.
72+
* Test afterGenerateElements method when depersonalization is needed.
7373
*
7474
* @return void
7575
*/
@@ -85,7 +85,7 @@ public function testAfterGenerateElements(): void
8585
}
8686

8787
/**
88-
* Tests afterGenerateElements method when depersonalization is not needed.
88+
* Test afterGenerateElements method when depersonalization is not needed.
8989
*
9090
* @return void
9191
*/

app/code/Magento/PageCache/Test/Unit/Model/Layout/LayoutPluginTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Framework\App\Response\Http;
1313
use Magento\Framework\App\ResponseInterface;
1414
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
15-
use Magento\Framework\View\LayoutInterface;
15+
use Magento\Framework\View\Layout;
1616
use Magento\PageCache\Model\Config;
1717
use Magento\PageCache\Model\Layout\LayoutPlugin;
1818
use Magento\PageCache\Test\Unit\Block\Controller\StubBlock;
@@ -35,7 +35,7 @@ class LayoutPluginTest extends TestCase
3535
private $responseMock;
3636

3737
/**
38-
* @var LayoutInterface|MockObject
38+
* @var Layout|MockObject
3939
*/
4040
private $layoutMock;
4141

@@ -54,7 +54,7 @@ class LayoutPluginTest extends TestCase
5454
*/
5555
protected function setUp()
5656
{
57-
$this->layoutMock = $this->getMockForAbstractClass(LayoutInterface::class);
57+
$this->layoutMock = $this->createPartialMock(Layout::class, ['isCacheable', 'getAllBlocks']);
5858
$this->responseMock = $this->createMock(Http::class);
5959
$this->configMock = $this->createMock(Config::class);
6060
$this->maintenanceModeMock = $this->createMock(MaintenanceMode::class);

0 commit comments

Comments
 (0)