public function EntityMutationTest::testDeleteEntityMutation in GraphQL 8.3
Test entity deletion.
File
- modules/
graphql_core/ tests/ src/ Kernel/ EntityMutation/ EntityMutationTest.php, line 201
Class
- EntityMutationTest
- Test abstract entity mutation classes.
Namespace
Drupal\Tests\graphql_core\Kernel\EntityMutationCode
public function testDeleteEntityMutation() {
$this
->mockMutation('deleteNode', [
'name' => 'deleteNode',
'entity_type' => 'node',
'entity_bundle' => 'test',
'arguments' => [
'id' => 'String',
],
'type' => 'EntityCrudOutput',
]);
$this
->createNode([
'title' => 'Test',
'status' => 1,
'type' => 'test',
]);
$this
->assertResults('mutation ($nid: String!) { deleteNode(id: $nid) { entity { entityLabel } } }', [
'nid' => '1',
], [
'deleteNode' => [
'entity' => [
'entityLabel' => 'Test',
],
],
], $this
->defaultMutationCacheMetaData());
$this
->assertEmpty(Node::load(1));
}