chore: code refactor via rector
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use App\Models\Email;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
@@ -36,7 +37,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_create_email_with_factory()
|
||||
public function it_can_create_email_with_factory(): void
|
||||
{
|
||||
$email = Email::factory()->create();
|
||||
|
||||
@@ -47,7 +48,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_correct_fillable_attributes()
|
||||
public function it_has_correct_fillable_attributes(): void
|
||||
{
|
||||
$emailData = [
|
||||
'message_id' => '12345',
|
||||
@@ -63,7 +64,7 @@ class EmailTest extends TestCase
|
||||
'mailbox' => 'INBOX',
|
||||
];
|
||||
|
||||
$email = Email::create($emailData);
|
||||
$email = Email::query()->create($emailData);
|
||||
|
||||
foreach ($emailData as $key => $value) {
|
||||
$this->assertEquals($value, $email->$key);
|
||||
@@ -71,7 +72,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_casts_attributes_correctly()
|
||||
public function it_casts_attributes_correctly(): void
|
||||
{
|
||||
$email = Email::factory()->create([
|
||||
'to' => ['test1@example.com', 'test2@example.com'],
|
||||
@@ -89,7 +90,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_validates_email_format_in_fetch_email_from_db()
|
||||
public function it_validates_email_format_in_fetch_email_from_db(): void
|
||||
{
|
||||
$result = Email::fetchEmailFromDB('invalid-email');
|
||||
|
||||
@@ -97,7 +98,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_fetches_emails_from_database_with_valid_email()
|
||||
public function it_fetches_emails_from_database_with_valid_email(): void
|
||||
{
|
||||
$email1 = Email::factory()->create(['to' => ['test@example.com']]);
|
||||
$email2 = Email::factory()->create(['to' => ['other@example.com']]);
|
||||
@@ -112,15 +113,15 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_orders_emails_by_timestamp_descending_in_fetch_email_from_db()
|
||||
public function it_orders_emails_by_timestamp_descending_in_fetch_email_from_db(): void
|
||||
{
|
||||
$oldEmail = Email::factory()->create([
|
||||
'to' => ['test@example.com'],
|
||||
'timestamp' => Carbon::now()->subHours(2),
|
||||
'timestamp' => Date::now()->subHours(2),
|
||||
]);
|
||||
$newEmail = Email::factory()->create([
|
||||
'to' => ['test@example.com'],
|
||||
'timestamp' => Carbon::now(),
|
||||
'timestamp' => Date::now(),
|
||||
]);
|
||||
|
||||
$results = Email::fetchEmailFromDB('test@example.com');
|
||||
@@ -130,7 +131,7 @@ class EmailTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_sets_correct_table_name()
|
||||
public function it_sets_correct_table_name(): void
|
||||
{
|
||||
$email = new Email;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user