You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Test/Integration/Category/CategoryCacheTest.php
+87-49Lines changed: 87 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -38,17 +38,9 @@ protected function setUp(): void
38
38
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36';
39
39
}
40
40
41
-
protectedfunctionresetCache($testMethod): void
42
-
{
43
-
if (!in_array($testMethod, self::$cacheResets)) {
44
-
$this->cacheManager->clean(['full_page']);
45
-
self::$cacheResets[] = $testMethod;
46
-
}
47
-
}
48
-
49
41
publicstaticfunctionsetUpBeforeClass(): void
50
42
{
51
-
// self::reindexAll();
43
+
self::reindexAll();
52
44
}
53
45
54
46
/** You must index to OpenSearch to get the default backend render */
@@ -70,6 +62,21 @@ protected static function reindexAll(): void
70
62
}
71
63
}
72
64
65
+
/**
66
+
* Selectively refresh the FPC cache (must be done at intervals)
67
+
* Warm the cache via MISS tests but only reset the cache once per MISS test
68
+
* Due to data provider test methods can be called multiple times
69
+
* @param $testMethod
70
+
* @return void
71
+
*/
72
+
protectedfunctionresetCache($testMethod): void
73
+
{
74
+
if (!in_array($testMethod, self::$cacheResets)) {
75
+
$this->cacheManager->clean(['full_page']);
76
+
self::$cacheResets[] = $testMethod;
77
+
}
78
+
}
79
+
73
80
/**
74
81
* @dataProvider getCategoryProvider
75
82
* @depends testFullPageCacheAvailable
@@ -103,40 +110,6 @@ public function testCategoryPlpMissBackendRenderOn(int $categoryId, string $name
103
110
$this->assertMatchesRegularExpression('/<div.*class=.*products-grid.*>/', $response->getContent(), $response->getContent(), 'Backend content was not rendered.');
104
111
}
105
112
106
-
/**
107
-
* The \Magento\TestFramework\TestCase\AbstractController::dispatch is flawed for this use case as it does not
108
-
* populate the URI which is used to build the cache key in \Magento\Framework\App\PageCache\Identifier::getValue
@@ -257,6 +230,77 @@ public function testCategoryPlpMissBackendRenderWhiteList(int $categoryId, strin
257
230
$this->assertMatchesRegularExpression('/<div.*class=.*products-grid.*>/', $response->getContent(), $response->getContent(), 'Backend content was not rendered.');
0 commit comments