- public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) {
- return $this->app[EntityRepo::class]->createFromInput('chapter', $input, $book);
+ protected function assertActivityExists(string $key, Entity $entity = null)
+ {
+ $detailsToCheck = ['key' => $key];
+
+ if ($entity) {
+ $detailsToCheck['entity_type'] = $entity->getMorphClass();
+ $detailsToCheck['entity_id'] = $entity->id;
+ }
+
+ $this->assertDatabaseHas('activities', $detailsToCheck);