@@ -51,16 +51,19 @@ protected function setUp(): void
51
51
52
52
/**
53
53
* Runs various GraphQL queries and checks if state of shared objects in Object Manager have changed
54
- *
54
+ * @magentoConfigFixture base_website btob/website_configuration/company_active 1
55
+ * @magentoConfigFixture default_store btob/website_configuration/company_active 1
56
+ * @magentoConfigFixture default_store company/general/allow_company_registration 1
55
57
* @dataProvider queryDataProvider
56
58
* @param string $query
57
59
* @param array $variables
60
+ * @param array $variables2 This is the second set of variables to be used in the second request
58
61
* @param string $operationName
59
62
* @param string $expected
60
63
* @return void
61
64
* @throws \Exception
62
65
*/
63
- public function testState (string $ query , array $ variables , string $ operationName , string $ expected ): void
66
+ public function testState (string $ query , array $ variables , array $ variables2 , string $ operationName , string $ expected ): void
64
67
{
65
68
$ jsonEncodedRequest = json_encode ([
66
69
'query ' => $ query ,
@@ -69,9 +72,15 @@ public function testState(string $query, array $variables, string $operationName
69
72
]);
70
73
$ output1 = $ this ->request ($ jsonEncodedRequest , $ operationName , true );
71
74
$ this ->assertStringContainsString ($ expected , $ output1 );
75
+ if ($ variables2 ) {
76
+ $ jsonEncodedRequest = json_encode ([
77
+ 'query ' => $ query ,
78
+ 'variables ' => $ variables2 ,
79
+ 'operationName ' => $ operationName
80
+ ]);
81
+ }
72
82
$ output2 = $ this ->request ($ jsonEncodedRequest , $ operationName );
73
83
$ this ->assertStringContainsString ($ expected , $ output2 );
74
- $ this ->assertEquals ($ output1 , $ output2 );
75
84
}
76
85
77
86
/**
@@ -160,6 +169,7 @@ public function queryDataProvider(): array
160
169
}
161
170
QUERY,
162
171
['id ' => 4 ],
172
+ [],
163
173
'navigationMenu ' ,
164
174
'"id":4,"name":"Category 1.1","product_count":2, '
165
175
],
@@ -209,6 +219,7 @@ public function queryDataProvider(): array
209
219
}
210
220
QUERY,
211
221
['name ' => 'Configurable%20Product ' , 'onServer ' => false ],
222
+ [],
212
223
'productDetailByName ' ,
213
224
'"sku":"configurable","name":"Configurable Product" '
214
225
],
@@ -257,6 +268,7 @@ public function queryDataProvider(): array
257
268
}
258
269
QUERY,
259
270
['id ' => 4 , 'currentPage ' => 1 , 'pageSize ' => 12 ],
271
+ [],
260
272
'category ' ,
261
273
'"url_key":"category-1-1","name":"Category 1.1" '
262
274
],
@@ -320,6 +332,7 @@ public function queryDataProvider(): array
320
332
}
321
333
QUERY,
322
334
['name ' => 'Simple Product1 ' , 'onServer ' => false ],
335
+ [],
323
336
'productDetail ' ,
324
337
'"sku":"simple1","name":"Simple Product1" '
325
338
],
@@ -333,9 +346,10 @@ public function queryDataProvider(): array
333
346
}
334
347
QUERY,
335
348
['urlKey ' => 'no-route ' ],
349
+ [],
336
350
'resolveUrl ' ,
337
351
'"type":"CMS_PAGE","id":1 '
338
- ],
352
+ ]
339
353
];
340
354
}
341
355
}
0 commit comments