chore: code refactor via rector
This commit is contained in:
@@ -9,6 +9,7 @@ use Tests\TestCase;
|
||||
|
||||
class PremiumEmailTest extends TestCase
|
||||
{
|
||||
public $user;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -17,7 +18,7 @@ class PremiumEmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_create_a_premium_email_with_factory()
|
||||
public function it_can_create_a_premium_email_with_factory(): void
|
||||
{
|
||||
$premiumEmail = PremiumEmail::factory()->create();
|
||||
|
||||
@@ -27,7 +28,7 @@ class PremiumEmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_correct_fillable_attributes()
|
||||
public function it_has_correct_fillable_attributes(): void
|
||||
{
|
||||
$premiumEmailData = [
|
||||
'user_id' => $this->user->id,
|
||||
@@ -38,7 +39,7 @@ class PremiumEmailTest extends TestCase
|
||||
'to' => ['recipient@example.com'],
|
||||
];
|
||||
|
||||
$premiumEmail = PremiumEmail::create($premiumEmailData);
|
||||
$premiumEmail = PremiumEmail::query()->create($premiumEmailData);
|
||||
|
||||
foreach ($premiumEmailData as $key => $value) {
|
||||
$this->assertEquals($value, $premiumEmail->$key);
|
||||
@@ -46,7 +47,7 @@ class PremiumEmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_belongs_to_a_user()
|
||||
public function it_belongs_to_a_user(): void
|
||||
{
|
||||
$premiumEmail = PremiumEmail::factory()->create(['user_id' => $this->user->id]);
|
||||
|
||||
@@ -55,7 +56,7 @@ class PremiumEmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_casts_timestamp_to_datetime()
|
||||
public function it_casts_timestamp_to_datetime(): void
|
||||
{
|
||||
$timestamp = now()->subDays(5);
|
||||
$premiumEmail = PremiumEmail::factory()->create(['timestamp' => $timestamp]);
|
||||
@@ -65,13 +66,13 @@ class PremiumEmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_query_seen_and_unseen_emails()
|
||||
public function it_can_query_seen_and_unseen_emails(): void
|
||||
{
|
||||
$seenEmail = PremiumEmail::factory()->create(['is_seen' => true]);
|
||||
$unseenEmail = PremiumEmail::factory()->create(['is_seen' => false]);
|
||||
PremiumEmail::factory()->create(['is_seen' => true]);
|
||||
PremiumEmail::factory()->create(['is_seen' => false]);
|
||||
|
||||
$seenEmails = PremiumEmail::where('is_seen', true)->get();
|
||||
$unseenEmails = PremiumEmail::where('is_seen', false)->get();
|
||||
$seenEmails = PremiumEmail::query()->where('is_seen', true)->get();
|
||||
$unseenEmails = PremiumEmail::query()->where('is_seen', false)->get();
|
||||
|
||||
$this->assertCount(1, $seenEmails);
|
||||
$this->assertCount(1, $unseenEmails);
|
||||
|
||||
Reference in New Issue
Block a user