/** * Make sure the slug is made up from the title */ public function testSlug() { $user = factory(User::class)->create(); $article = new Article(); $article->setBody('This is the body'); $article->setTitle('This is the title'); $article->user()->associate($user); $article->setPublished(Article::PUBLISHED); $article->setPublishedAt(Carbon::now()); $article->save(); $this->assertEquals('this-is-the-title', $article->slug); }