10
10
use Magento \Customer \Api \AccountManagementInterface ;
11
11
use Magento \Customer \Model \AccountManagement ;
12
12
use Magento \Customer \Model \CustomerRegistry ;
13
+ use Magento \Framework \App \Area ;
13
14
use Magento \Framework \App \Http as HttpApp ;
14
15
use Magento \Framework \App \ObjectManager as AppObjectManager ;
15
16
use Magento \Framework \App \RequestInterface ;
16
17
use Magento \Framework \App \Response \Http as HttpResponse ;
18
+ use Magento \Framework \App \State ;
17
19
use Magento \Framework \Exception \LocalizedException ;
18
20
use Magento \Framework \Exception \NoSuchEntityException ;
19
21
use Magento \Framework \ObjectManagerInterface ;
@@ -55,6 +57,16 @@ class GraphQlStateDiff
55
57
*/
56
58
private readonly Comparator $ comparator ;
57
59
60
+ /**
61
+ * @var State
62
+ */
63
+ private State $ appState ;
64
+
65
+ /**
66
+ * @var string|null
67
+ */
68
+ private ?string $ currentArea ;
69
+
58
70
/**
59
71
* Constructor
60
72
*/
@@ -66,6 +78,9 @@ public function __construct()
66
78
AppObjectManager::setInstance ($ this ->objectManagerForTest );
67
79
Bootstrap::setObjectManager ($ this ->objectManagerForTest );
68
80
$ this ->comparator = $ this ->objectManagerForTest ->create (Comparator::class);
81
+ $ this ->appState = $ this ->objectManagerForTest ->get (State::class);
82
+ $ this ->currentArea = $ this ->appState ->getAreaCode ();
83
+ $ this ->appState ->setAreaCode (Area::AREA_GRAPHQL );
69
84
$ this ->objectManagerForTest ->_resetState ();
70
85
}
71
86
@@ -86,6 +101,7 @@ public function getTestObjectManager()
86
101
*/
87
102
public function tearDown (): void
88
103
{
104
+ $ this ->appState ->setAreaCode ($ this ->currentArea );
89
105
$ this ->objectManagerBeforeTest ->getFactory ()->setObjectManager ($ this ->objectManagerBeforeTest );
90
106
AppObjectManager::setInstance ($ this ->objectManagerBeforeTest );
91
107
Bootstrap::setObjectManager ($ this ->objectManagerBeforeTest );
0 commit comments