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 7
7
8
8
namespace Magento \PageCache \Model \App ;
9
9
10
+ use Magento \Framework \App \Cache \StateInterface ;
10
11
use Magento \Framework \App \PageCache \Identifier ;
11
12
use Magento \Framework \App \Request \Http ;
12
13
use Magento \Framework \ObjectManagerInterface ;
@@ -48,16 +49,37 @@ class CacheIdentifierPluginTest extends TestCase
48
49
*/
49
50
private $ fixtures ;
50
51
52
+ /**
53
+ * @var StateInterface
54
+ */
55
+ private $ cacheState ;
56
+
57
+ /**
58
+ * @var bool
59
+ */
60
+ private $ originalCacheState ;
61
+
51
62
protected function setUp (): void
52
63
{
53
64
$ this ->objectManager = Bootstrap::getObjectManager ();
54
65
$ this ->request = $ this ->objectManager ->get (Http::class);
55
66
$ this ->identifier = $ this ->objectManager ->get (Identifier::class);
56
67
$ 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 );
57
72
58
73
// 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
+ }
61
83
}
62
84
63
85
/**
You can’t perform that action at this time.
0 commit comments