From 18ad013cd5aaba44ab6b38a1ec0b2680f39a667f Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 16 Feb 2022 14:20:18 +0100 Subject: [PATCH] Validate connected entity exists in nested BelongsTo --- .../MutationExecutor/BelongsToTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Integration/Execution/MutationExecutor/BelongsToTest.php b/tests/Integration/Execution/MutationExecutor/BelongsToTest.php index a7fecddb25..bc4e29a672 100644 --- a/tests/Integration/Execution/MutationExecutor/BelongsToTest.php +++ b/tests/Integration/Execution/MutationExecutor/BelongsToTest.php @@ -112,6 +112,25 @@ public function testCreateAndConnectWithBelongsTo(): void ]); } + public function testConnectNonExisting(): void + { + $this + ->graphQL(/** @lang GraphQL */ ' + mutation { + createTask(input: { + name: "foo" + user: { + connect: 1 + } + }) { + id + } + } + ') + ->dump() + ->assertGraphQLErrorMessage('Can not connect non-existing User 1'); + } + public function testBelongsToExplicitNullHasNoEffect(): void { $this->graphQL(/** @lang GraphQL */ '