Skip to content

Commit

Permalink
CHANGE TEST WITH EXISTING MODELS
Browse files Browse the repository at this point in the history
  • Loading branch information
saeed-rostami committed Jul 18, 2024
1 parent f7187fc commit 9b7c7a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ public function testQueryHasOneThroughRelationship()
}
';

// $task = factory(Task::class)->create();
// assert($task instanceof Task);

$post = factory(Post::class)->create();
assert($post instanceof Post);

$post_status = factory(PostStatus::class)->create();
assert($post_status instanceof PostStatus);

// $task->post()->save($post);
$post->status()->save($post_status);

$task = Task::query()->first();
$task_status = $task->postStatus()->first();
if (!empty($task)) {
$task_status = $task->postStatus;
}

$this->graphQL(/** @lang GraphQL */ '
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Utils/Models/PostStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @property int|null $post_id
*
* Relations
* @property-read \Illuminate\Database\Eloquent\Collection<\Tests\Utils\Models\Post> $task
* @property-read \Illuminate\Database\Eloquent\Collection<\Tests\Utils\Models\Post> $post
*/

final class PostStatus extends Model
Expand Down

0 comments on commit 9b7c7a0

Please sign in to comment.