+ public function test_create_sets_tags()
+ {
+ // Cheeky initial update to refresh slug
+ $this->asEditor()->post('books', [
+ 'name' => 'My book with tags',
+ 'description' => 'A book with tags',
+ 'tags' => [
+ [
+ 'name' => 'Category',
+ 'value' => 'Donkey Content',
+ ],
+ [
+ 'name' => 'Level',
+ 'value' => '5',
+ ],
+ ],
+ ]);
+
+ /** @var Book $book */
+ $book = Book::query()->where('name', '=', 'My book with tags')->firstOrFail();
+ $tags = $book->tags()->get();
+
+ $this->assertEquals(2, $tags->count());
+ $this->assertEquals('Donkey Content', $tags[0]->value);
+ $this->assertEquals('Level', $tags[1]->name);
+ }
+