-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added mutation support - Added GraphQL functional test as an example of how to add mutations
- Loading branch information
Alex Paliarush
committed
Jul 2, 2018
1 parent
f947cad
commit db3f2c7
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\TestModule; | ||
|
||
use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
|
||
/** | ||
* Make sure that it is possible to use GraphQL mutations in Magento | ||
*/ | ||
class GraphQlMutationTest extends GraphQlAbstract | ||
{ | ||
public function testMutation() | ||
{ | ||
$id = 3; | ||
|
||
$query = <<<MUTATION | ||
mutation { | ||
testItem(id: {$id}) { | ||
item_id, | ||
name, | ||
integer_list | ||
} | ||
} | ||
MUTATION; | ||
|
||
$response = $this->graphQlQuery($query); | ||
$this->assertArrayHasKey('testItem', $response); | ||
$testItem = $response['testItem']; | ||
$this->assertArrayHasKey('integer_list', $testItem); | ||
$this->assertEquals([4, 5, 6], $testItem['integer_list']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters