16
16
use Magento \Framework \App \Config \ScopeConfigInterface ;
17
17
use Magento \Framework \ObjectManagerInterface ;
18
18
use Magento \Store \Api \Data \StoreInterface ;
19
- use Magento \Store \Model \ScopeInterface ;
20
19
use Magento \Store \Model \StoreManagerInterface ;
21
20
use Magento \TestFramework \Helper \Bootstrap ;
22
21
use Magento \TestFramework \TestCase \GraphQlAbstract ;
@@ -40,6 +39,8 @@ protected function setUp()
40
39
parent ::setUp ();
41
40
42
41
$ this ->objectManager = Bootstrap::getObjectManager ();
42
+
43
+ // TODO: remove usage of the Config, use ConfigFixture instead https://github.com/magento/graphql-ce/issues/167
43
44
$ this ->config = $ this ->objectManager ->get (Config::class);
44
45
$ this ->saveAgreementConfig (1 );
45
46
}
@@ -124,29 +125,17 @@ public function testGetAgreementNotSet()
124
125
/**
125
126
* @magentoApiDataFixture Magento/CheckoutAgreements/_files/agreement_active_with_html_content.php
126
127
* @magentoApiDataFixture Magento/CheckoutAgreements/_files/agreement_inactive_with_text_content.php
127
- * @magentoApiDataFixture Magento/Store/_files/second_store.php
128
128
*/
129
129
public function testDisabledAgreements ()
130
130
{
131
- $ secondStoreCode = 'fixture_second_store ' ;
132
- $ agreementsName = 'Checkout Agreement (active) ' ;
133
-
134
131
$ query = $ this ->getQuery ();
135
- $ this ->assignAgreementsToStore ( $ secondStoreCode , $ agreementsName );
132
+ $ this ->saveAgreementConfig ( 0 );
136
133
137
- /** @var StoreManagerInterface $storeManager */
138
- $ storeManager = $ this ->objectManager ->get (StoreManagerInterface::class);
139
- $ store = $ storeManager ->getStore ($ secondStoreCode );
140
- $ this ->saveAgreementConfig (0 , $ store );
141
-
142
- $ headerMap ['Store ' ] = $ secondStoreCode ;
143
- $ response = $ this ->graphQlQuery ($ query , [], '' , $ headerMap );
134
+ $ response = $ this ->graphQlQuery ($ query );
144
135
145
136
$ this ->assertArrayHasKey ('checkoutAgreements ' , $ response );
146
137
$ agreements = $ response ['checkoutAgreements ' ];
147
138
$ this ->assertCount (0 , $ agreements );
148
-
149
- $ this ->deleteAgreementConfig ($ store );
150
139
}
151
140
152
141
/**
@@ -200,31 +189,29 @@ protected function tearDown()
200
189
* @param int $value
201
190
* @param StoreInterface $store
202
191
*/
203
- private function saveAgreementConfig (int $ value, ? StoreInterface $ store = null ): void
192
+ private function saveAgreementConfig (int $ value ): void
204
193
{
205
- $ scopeId = $ store ? $ store ->getId () : 0 ;
206
- $ scope = $ store ? ScopeInterface::SCOPE_STORE : ScopeConfigInterface::SCOPE_TYPE_DEFAULT ;
207
194
$ this ->config ->saveConfig (
208
195
$ this ->agreementsXmlConfigPath ,
209
196
$ value ,
210
- $ scope ,
211
- $ scopeId
197
+ ScopeConfigInterface:: SCOPE_TYPE_DEFAULT ,
198
+ 0
212
199
);
213
200
214
201
$ this ->reinitConfig ();
215
202
}
216
203
217
204
/**
218
- * @param StoreInterface $store
205
+ * Delete config
206
+ *
207
+ * @return void
219
208
*/
220
- private function deleteAgreementConfig (? StoreInterface $ store = null ): void
209
+ private function deleteAgreementConfig (): void
221
210
{
222
- $ scopeId = $ store ? $ store ->getId () : 0 ;
223
- $ scope = $ store ? ScopeInterface::SCOPE_STORE : ScopeConfigInterface::SCOPE_TYPE_DEFAULT ;
224
211
$ this ->config ->deleteConfig (
225
212
$ this ->agreementsXmlConfigPath ,
226
- $ scope ,
227
- $ scopeId
213
+ ScopeConfigInterface:: SCOPE_TYPE_DEFAULT ,
214
+ 0
228
215
);
229
216
230
217
$ this ->reinitConfig ();
0 commit comments