File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
dev/tests/integration/testsuite/Magento/PageCache/Model/App Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 77
88namespace Magento \PageCache \Model \App ;
99
10+ use Magento \Framework \App \Cache \StateInterface ;
1011use Magento \Framework \App \PageCache \Identifier ;
1112use Magento \Framework \App \Request \Http ;
1213use Magento \Framework \ObjectManagerInterface ;
@@ -48,16 +49,37 @@ class CacheIdentifierPluginTest extends TestCase
4849 */
4950 private $ fixtures ;
5051
52+ /**
53+ * @var StateInterface
54+ */
55+ private $ cacheState ;
56+
57+ /**
58+ * @var bool
59+ */
60+ private $ originalCacheState ;
61+
5162 protected function setUp (): void
5263 {
5364 $ this ->objectManager = Bootstrap::getObjectManager ();
5465 $ this ->request = $ this ->objectManager ->get (Http::class);
5566 $ this ->identifier = $ this ->objectManager ->get (Identifier::class);
5667 $ this ->fixtures = $ this ->objectManager ->get (DataFixtureStorageManager::class)->getStorage ();
68+ $ this ->cacheState = $ this ->objectManager ->get (StateInterface::class);
69+
70+ // Store original cache state
71+ $ this ->originalCacheState = $ this ->cacheState ->isEnabled (Type::TYPE_IDENTIFIER );
5772
5873 // Enable the cache type
59- $ this ->objectManager ->get (\Magento \Framework \App \Cache \StateInterface::class)
60- ->setEnabled (Type::TYPE_IDENTIFIER , true );
74+ $ this ->cacheState ->setEnabled (Type::TYPE_IDENTIFIER , true );
75+ }
76+
77+ protected function tearDown (): void
78+ {
79+ // Revert cache state to original
80+ if (isset ($ this ->cacheState ) && isset ($ this ->originalCacheState )) {
81+ $ this ->cacheState ->setEnabled (Type::TYPE_IDENTIFIER , $ this ->originalCacheState );
82+ }
6183 }
6284
6385 /**
You can’t perform that action at this time.
0 commit comments