This commit is contained in:
johny
2026-01-12 12:37:16 +01:00
commit 516e51e0e9
76 changed files with 11962 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<?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);
}
}