add start and end date and test for null entries
This commit is contained in:
parent
f8a1c2616d
commit
a752ff9ba5
3 changed files with 56 additions and 0 deletions
|
|
@ -59,6 +59,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
$this->assertEquals('testPlan', $plan->getName());
|
||||
}
|
||||
|
|
@ -69,6 +71,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
$this->assertInstanceOf(User::class, $plan->getUser());
|
||||
}
|
||||
|
|
@ -81,6 +85,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 1,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +98,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 1,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +115,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
$this->assertNotNull($this->scheduledNodeRepo->find(0));
|
||||
}
|
||||
|
|
@ -128,6 +138,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
$this->assertEquals(
|
||||
1,
|
||||
|
|
@ -144,6 +156,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: null,
|
||||
name: 'testPlan',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -156,6 +170,8 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: 'testPlan',
|
||||
textId: null,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -168,6 +184,36 @@ class CreatePlanTest extends TestCase
|
|||
userId: 0,
|
||||
name: null,
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
public function test_throws_if_date_start_is_null(): void
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
$this->expectExceptionMessage('date start is required');
|
||||
|
||||
$this->useCase->execute(new CreatePlanRequest(
|
||||
userId: 0,
|
||||
name: 'test',
|
||||
textId: 0,
|
||||
dateStart: null,
|
||||
dateEnd: '2025-01-01',
|
||||
));
|
||||
}
|
||||
|
||||
public function test_throws_if_date_end_is_null(): void
|
||||
{
|
||||
$this->expectException(BadRequestException::class);
|
||||
$this->expectExceptionMessage('date end is required');
|
||||
|
||||
$this->useCase->execute(new CreatePlanRequest(
|
||||
userId: 0,
|
||||
name: 'test',
|
||||
textId: 0,
|
||||
dateStart: '2025-01-01',
|
||||
dateEnd: null,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue