Files
gorilla/tests/Unit/InspectionTest.php
2026-01-12 12:37:16 +01:00

62 lines
1.6 KiB
PHP

<?php
namespace Tests\Unit;
use App\Service\Entities\InputEntity;
use App\Service\Entities\Inspection;
use Tests\TestCase;
class InspectionTest extends TestCase
{
public function testStatusIsNowyWhenDateIsEmpty()
{
$inputEntity = new InputEntity([
'number' => 1,
'description' => 'Test',
'dueDate' => '',
]);
$inspection = new Inspection($inputEntity);
$this->assertEquals('nowy', $inspection->status->value);
}
public function testStatusIsZaplanowanyWhenDateIsNotEmpty()
{
$inputEntity = new InputEntity([
'number' => 1,
'description' => 'Test',
'dueDate' => '2020-01-01',
]);
$inspection = new Inspection($inputEntity);
$this->assertEquals('zaplanowany', $inspection->status->value);
}
public function testThereIsWeekOfYearWhenDateIsSet()
{
$inputEntity = new InputEntity([
'number' => 1,
'description' => 'Test',
'dueDate' => '2020-01-07',
]);
$inspection = new Inspection($inputEntity);
$this->assertNotNull($inspection->serviceWeek);
$this->assertEquals(2, $inspection->serviceWeek);
}
public function testThereIsNoWeekOfYearWhenDateIsNotSet()
{
$inputEntity = new InputEntity([
'number' => 1,
'description' => 'Test',
'dueDate' => '',
]);
$inspection = new Inspection($inputEntity);
$this->assertNull($inspection->serviceWeek);
}
}