1010use Magento \Customer \Api \AccountManagementInterface ;
1111use Magento \Customer \Model \AccountManagement ;
1212use Magento \Customer \Model \CustomerRegistry ;
13+ use Magento \Framework \App \Area ;
1314use Magento \Framework \App \Http as HttpApp ;
1415use Magento \Framework \App \ObjectManager as AppObjectManager ;
1516use Magento \Framework \App \RequestInterface ;
1617use Magento \Framework \App \Response \Http as HttpResponse ;
18+ use Magento \Framework \App \State ;
1719use Magento \Framework \Exception \LocalizedException ;
1820use Magento \Framework \Exception \NoSuchEntityException ;
1921use Magento \Framework \ObjectManagerInterface ;
@@ -55,6 +57,16 @@ class GraphQlStateDiff
5557 */
5658 private readonly Comparator $ comparator ;
5759
60+ /**
61+ * @var State
62+ */
63+ private State $ appState ;
64+
65+ /**
66+ * @var string|null
67+ */
68+ private ?string $ currentArea ;
69+
5870 /**
5971 * Constructor
6072 */
@@ -66,6 +78,9 @@ public function __construct()
6678 AppObjectManager::setInstance ($ this ->objectManagerForTest );
6779 Bootstrap::setObjectManager ($ this ->objectManagerForTest );
6880 $ 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 );
6984 $ this ->objectManagerForTest ->_resetState ();
7085 }
7186
@@ -86,6 +101,7 @@ public function getTestObjectManager()
86101 */
87102 public function tearDown (): void
88103 {
104+ $ this ->appState ->setAreaCode ($ this ->currentArea );
89105 $ this ->objectManagerBeforeTest ->getFactory ()->setObjectManager ($ this ->objectManagerBeforeTest );
90106 AppObjectManager::setInstance ($ this ->objectManagerBeforeTest );
91107 Bootstrap::setObjectManager ($ this ->objectManagerBeforeTest );
0 commit comments