chore: code refactor via rector
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\TicketResponse;
|
||||
use App\Models\User;
|
||||
@@ -10,6 +11,8 @@ use Tests\TestCase;
|
||||
|
||||
class TicketTest extends TestCase
|
||||
{
|
||||
public $user;
|
||||
public $ticketData;
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@@ -27,7 +30,7 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_can_create_a_ticket_with_factory()
|
||||
public function it_can_create_a_ticket_with_factory(): void
|
||||
{
|
||||
$ticket = Ticket::factory()->create();
|
||||
|
||||
@@ -37,9 +40,9 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_correct_fillable_attributes()
|
||||
public function it_has_correct_fillable_attributes(): void
|
||||
{
|
||||
$ticket = Ticket::create($this->ticketData);
|
||||
$ticket = Ticket::query()->create($this->ticketData);
|
||||
|
||||
foreach ($this->ticketData as $key => $value) {
|
||||
if ($key === 'last_response_at') {
|
||||
@@ -52,7 +55,7 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_belongs_to_user()
|
||||
public function it_belongs_to_user(): void
|
||||
{
|
||||
$ticket = Ticket::factory()->create(['user_id' => $this->user->id]);
|
||||
|
||||
@@ -61,7 +64,7 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_has_many_ticket_responses()
|
||||
public function it_has_many_ticket_responses(): void
|
||||
{
|
||||
$ticket = Ticket::factory()->create();
|
||||
$response1 = TicketResponse::factory()->create(['ticket_id' => $ticket->id]);
|
||||
@@ -73,7 +76,7 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_casts_last_response_at_to_datetime()
|
||||
public function it_casts_last_response_at_to_datetime(): void
|
||||
{
|
||||
$ticket = Ticket::factory()->create([
|
||||
'last_response_at' => '2024-01-01 12:00:00',
|
||||
@@ -83,7 +86,7 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_uses_correct_table_name()
|
||||
public function it_uses_correct_table_name(): void
|
||||
{
|
||||
$ticket = new Ticket;
|
||||
|
||||
@@ -91,10 +94,10 @@ class TicketTest extends TestCase
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_extends_model_class()
|
||||
public function it_extends_model_class(): void
|
||||
{
|
||||
$ticket = new Ticket;
|
||||
|
||||
$this->assertInstanceOf(\Illuminate\Database\Eloquent\Model::class, $ticket);
|
||||
$this->assertInstanceOf(Model::class, $ticket);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user