Skip to content

Commit 228846c

Browse files
committed
MAGETWO-90390: GraphQlControllerTest:testOutputErrorsWithMessageCategoryAndTrace integration test failed with php 7.2
1 parent f2fed1e commit 228846c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

dev/tests/integration/testsuite/Magento/GraphQl/Controller/GraphQlControllerTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,14 @@
1919
* @magentoAppArea graphql
2020
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_url_key.php
2121
*/
22-
2322
class GraphQlControllerTest extends \PHPUnit\Framework\TestCase
2423
{
2524
const CONTENT_TYPE = 'application/json';
2625

27-
/**
28-
* @var \Magento\Framework\ObjectManagerInterface
29-
*/
26+
/** @var \Magento\Framework\ObjectManagerInterface */
3027
private $objectManager;
3128

32-
/**
33-
* @var GraphQl $graphql
34-
*/
29+
/** @var GraphQl */
3530
private $graphql;
3631

3732
/** @var SerializerInterface */
@@ -42,7 +37,6 @@ class GraphQlControllerTest extends \PHPUnit\Framework\TestCase
4237

4338
protected function setUp()
4439
{
45-
// parent::setUp();
4640
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
4741
$this->graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class);
4842
$this->jsonSerializer = $this->objectManager->get(SerializerInterface::class);
@@ -88,7 +82,10 @@ public function testDispatch()
8882
$response = $this->graphql->dispatch($request);
8983
$output = $this->jsonSerializer->unserialize($response->getContent());
9084
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
91-
$this->assertTrue(count($output['data']['products']['items']) > 0, 'Products array has items');
85+
86+
$this->assertArrayNotHasKey('errors', $output, 'Response has errors');
87+
$this->assertTrue(!empty($output['data']['products']['items']), 'Products array has items');
88+
$this->assertTrue(!empty($output['data']['products']['items'][0]), 'Products array has items');
9289
$this->assertEquals($output['data']['products']['items'][0]['id'], $product->getData($linkField));
9390
$this->assertEquals($output['data']['products']['items'][0]['sku'], $product->getSku());
9491
$this->assertEquals($output['data']['products']['items'][0]['name'], $product->getName());

0 commit comments

Comments
 (0)