/**
  * @test
  */
 function it_creates_a_deeply_nested_structure_with_linked_models()
 {
     $genre = $this->createGenre();
     $authorA = $this->createAuthor();
     $authorB = $this->createAuthor();
     $data = ['title' => 'new title', 'body' => 'new body', 'genre' => $genre->id, 'comments' => [['title' => 'title 1', 'body' => 'body 1', 'author' => ['id' => $authorA->id]], ['title' => 'title 2', 'body' => 'body 2', 'author' => $authorB->id]], 'authors' => [$authorA->id, ['id' => $authorB->id]]];
     $updater = new ModelUpdater(Post::class);
     $updater->create($data);
     // check the whole structure
     $post = Post::latest()->first();
     $this->assertInstanceOf(Post::class, $post);
     $this->seeInDatabase('posts', ['id' => $post->id, 'title' => 'new title', 'body' => 'new body', 'genre_id' => $genre->id]);
     $this->seeInDatabase('comments', ['title' => 'title 1', 'body' => 'body 1', 'author_id' => $authorA->id]);
     $this->seeInDatabase('comments', ['title' => 'title 2', 'body' => 'body 2', 'author_id' => $authorB->id]);
     $this->seeInDatabase('author_post', ['post_id' => $post->id, 'author_id' => $authorA->id]);
     $this->seeInDatabase('author_post', ['post_id' => $post->id, 'author_id' => $authorB->id]);
 }