init
This commit is contained in:
61
tests/Unit/InspectionTest.php
Normal file
61
tests/Unit/InspectionTest.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user