2026-08-14 10:35:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Tests\Integration\Infra\Database\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
|
use Infra\Database\Models\Employee;
|
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
|
|
covers(Employee::class);
|
|
|
|
|
|
|
|
|
|
uses(TestCase::class, RefreshDatabase::class);
|
|
|
|
|
|
|
|
|
|
describe('Employee Eloquent Model & Factory', function (): void {
|
|
|
|
|
it('creates and persists an Employee record via factory', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$employee = Employee::factory()->create();
|
|
|
|
|
|
|
|
|
|
// WHEN
|
2026-08-14 11:33:05 +02:00
|
|
|
$retrieved = Employee::find($employee->public_employee_number);
|
2026-08-14 10:35:21 +02:00
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($retrieved)->not->toBeNull()
|
2026-08-14 11:33:05 +02:00
|
|
|
->and($retrieved->public_employee_number)->toBe($employee->public_employee_number);
|
2026-08-14 10:35:21 +02:00
|
|
|
});
|
|
|
|
|
});
|