Skip to content

Commit cdffb2b

Browse files
authored
Merge pull request #6012 from magento-performance/MC-36671
Fixed Issues: - MC-36671 Extend catalog GraphQl tests coverage
2 parents 7198c76 + 50fd0b6 commit cdffb2b

32 files changed

+3044
-16
lines changed

dev/tests/api-functional/framework/Magento/TestFramework/TestCase/GraphQlAbstract.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,61 @@ protected function assertResponseFields($actualResponse, $assertionMap)
184184
);
185185
}
186186
}
187+
188+
/**
189+
* Compare arrays recursively regardless of nesting.
190+
*
191+
* Can compare arrays that have both one level and n-level nesting.
192+
* ```
193+
* [
194+
* 'products' => [
195+
* 'items' => [
196+
* [
197+
* 'sku' => 'bundle-product',
198+
* 'type_id' => 'bundle',
199+
* 'items' => [
200+
* [
201+
* 'title' => 'Bundle Product Items',
202+
* 'sku' => 'bundle-product',
203+
* 'options' => [
204+
* [
205+
* 'price' => 2.75,
206+
* 'label' => 'Simple Product',
207+
* 'product' => [
208+
* 'name' => 'Simple Product',
209+
* 'sku' => 'simple',
210+
* ]
211+
* ]
212+
* ]
213+
* ]
214+
* ];
215+
* ```
216+
*
217+
* @param array $expected
218+
* @param array $actual
219+
* @return array
220+
*/
221+
public function compareArraysRecursively(array $expected, array $actual): array
222+
{
223+
$diffResult = [];
224+
225+
foreach ($expected as $key => $value) {
226+
if (array_key_exists($key, $actual)) {
227+
if (is_array($value)) {
228+
$recursiveDiff = $this->compareArraysRecursively($value, $actual[$key]);
229+
if (!empty($recursiveDiff)) {
230+
$diffResult[$key] = $recursiveDiff;
231+
}
232+
} else {
233+
if (!in_array($value, $actual, true)) {
234+
$diffResult[$key] = $value;
235+
}
236+
}
237+
} else {
238+
$diffResult[$key] = $value;
239+
}
240+
}
241+
242+
return $diffResult;
243+
}
187244
}

dev/tests/api-functional/framework/Magento/TestFramework/WebApiApplication.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class WebApiApplication extends Application
1414
{
1515
/**
16-
* {@inheritdoc}
16+
* @inheritdoc
1717
*/
1818
public function run()
1919
{
@@ -24,7 +24,7 @@ public function run()
2424
}
2525

2626
/**
27-
* {@inheritdoc}
27+
* @inheritdoc
2828
*/
2929
public function install($cleanup)
3030
{
@@ -45,19 +45,18 @@ public function install($cleanup)
4545
}
4646
continue;
4747
}
48-
if (!empty($optionValue)) {
49-
$installCmd .= " --$optionName=%s";
50-
$installArgs[] = $optionValue;
51-
}
48+
$installCmd .= " --$optionName=%s";
49+
$installArgs[] = $optionValue;
5250
}
5351
$this->_shell->execute($installCmd, $installArgs);
5452
}
5553
}
5654

5755
/**
58-
* Use the application as is
56+
* @inheritdoc
5957
*
60-
* {@inheritdoc}
58+
* Return empty array of custom directories
59+
* @return array
6160
*/
6261
protected function getCustomDirs()
6362
{

0 commit comments

Comments
 (0)