28 lines
681 B
PHP
28 lines
681 B
PHP
|
|
<?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
|
||
|
|
$retrieved = Employee::find($employee->id);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
expect($retrieved)->not->toBeNull()
|
||
|
|
->and($retrieved->id)->toBe($employee->id);
|
||
|
|
});
|
||
|
|
});
|