chore: code refactor via rector
This commit is contained in:
@@ -8,7 +8,7 @@ use Tests\TestCase;
|
||||
class PageTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_can_create_a_page_with_factory()
|
||||
public function it_can_create_a_page_with_factory(): void
|
||||
{
|
||||
$page = Page::factory()->create();
|
||||
|
||||
@@ -18,7 +18,7 @@ class PageTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_correct_fillable_attributes()
|
||||
public function it_has_correct_fillable_attributes(): void
|
||||
{
|
||||
$pageData = [
|
||||
'title' => 'About Us',
|
||||
@@ -31,7 +31,7 @@ class PageTest extends TestCase
|
||||
'is_published' => true,
|
||||
];
|
||||
|
||||
$page = Page::create($pageData);
|
||||
$page = Page::query()->create($pageData);
|
||||
|
||||
foreach ($pageData as $key => $value) {
|
||||
$this->assertEquals($value, $page->$key);
|
||||
@@ -39,7 +39,7 @@ class PageTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_generates_unique_slugs()
|
||||
public function it_generates_unique_slugs(): void
|
||||
{
|
||||
$page1 = Page::factory()->create(['title' => 'Same Title']);
|
||||
$page2 = Page::factory()->create(['title' => 'Same Title']);
|
||||
@@ -48,13 +48,13 @@ class PageTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_query_published_pages()
|
||||
public function it_can_query_published_pages(): void
|
||||
{
|
||||
$publishedPage = Page::factory()->create(['is_published' => true]);
|
||||
$draftPage = Page::factory()->create(['is_published' => false]);
|
||||
Page::factory()->create(['is_published' => true]);
|
||||
Page::factory()->create(['is_published' => false]);
|
||||
|
||||
$publishedPages = Page::where('is_published', true)->get();
|
||||
$draftPages = Page::where('is_published', false)->get();
|
||||
$publishedPages = Page::query()->where('is_published', true)->get();
|
||||
$draftPages = Page::query()->where('is_published', false)->get();
|
||||
|
||||
$this->assertCount(1, $publishedPages);
|
||||
$this->assertCount(1, $draftPages);
|
||||
|
||||
Reference in New Issue
Block a user