assertTrue(true); // Given // - I have two post records in the database // - They are posted a month apart $firstPost = factory(Post::class)->create(); $secondPost = factory(Post::class)->create([ 'created_at' => Carbon::now()->subMonth(), ]); // When I fetch the archives... $posts = Post::archives(); // Then the response should be in the proper format. $this->assertCount(2, $posts); $this->assertSame([ [ 'year' => (int) $firstPost->created_at->format('Y'), 'month' => $firstPost->created_at->format('F'), 'published' => 1, ], [ 'year' => (int) $secondPost->created_at->format('Y'), 'month' => $secondPost->created_at->format('F'), 'published' => 1, ], ], $posts); } }