/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/api-functional/testsuite/Magento/GraphQl/TestModule/GraphQlMutationTest.php
59 строк
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2018 Adobe * All Rights Reserved. */ 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->graphQlMutation($query); $this->assertArrayHasKey('testItem', $response); $testItem = $response['testItem']; $this->assertArrayHasKey('integer_list', $testItem); $this->assertEquals([4, 5, 6], $testItem['integer_list']); } /** */ public function testMutationIsNotAllowedViaGetRequest() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Mutation requests allowed only for POST requests'); $id = 3; $query = <<<MUTATION mutation { testItem(id: {$id}) { item_id name integer_list } } MUTATION; $this->graphQlQuery($query, [], '', []); } }