Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GraphQlMutationTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
16 {
17  public function testMutation()
18  {
19  $id = 3;
20 
21  $query = <<<MUTATION
22 mutation {
23  testItem(id: {$id}) {
24  item_id,
25  name,
26  integer_list
27  }
28 }
29 MUTATION;
30 
31  $response = $this->graphQlQuery($query);
32  $this->assertArrayHasKey('testItem', $response);
33  $testItem = $response['testItem'];
34  $this->assertArrayHasKey('integer_list', $testItem);
35  $this->assertEquals([4, 5, 6], $testItem['integer_list']);
36  }
37 }
$response
Definition: 404.php:11
$id
Definition: fieldset.phtml:14
graphQlQuery(string $query, array $variables=[], string $operationName='', array $headers=[])