Fix tests

This commit is contained in:
Jonny Barnes 2022-12-02 18:37:50 +00:00
parent f060f52520
commit 47e847d100
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8

View file

@ -79,9 +79,17 @@ class ArticlesTest extends TestCase
$emptyScope = Article::date()->get(); $emptyScope = Article::date()->get();
$this->assertCount(2, $emptyScope); $this->assertCount(2, $emptyScope);
}
// Check the December case /** @test */
$article = Article::factory()->create([ public function dateScopeReturnsExpectedArticlesForDecember(): void
{
Article::factory()->create([
'created_at' => Carbon::now()->setMonth(11)->toDateTimeString(),
'updated_at' => Carbon::now()->setMonth(11)->toDateTimeString(),
]);
Article::factory()->create([
'created_at' => Carbon::now()->setMonth(12)->toDateTimeString(), 'created_at' => Carbon::now()->setMonth(12)->toDateTimeString(),
'updated_at' => Carbon::now()->setMonth(12)->toDateTimeString(), 'updated_at' => Carbon::now()->setMonth(12)->toDateTimeString(),
]); ]);