Erweitere die Tests
This commit is contained in:
@@ -32,8 +32,9 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
parent::_before();
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -260,6 +261,28 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
$this->assertNotEmpty($response->getBody()->getContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotDatabasesException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testUpdateExistRecordWithoutHomeOffice(): void
|
||||
{
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
$response = $controller->update($this->request, $this->response, [
|
||||
'id' => self::EXISTING_DATE,
|
||||
]);
|
||||
$this->assertEquals(self::FICTIONAL_STATUS_CODE, $response->getStatusCode());
|
||||
$this->assertNotEmpty($response->getBody()->getContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotDatabasesException
|
||||
@@ -302,12 +325,13 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
* @throws Exception
|
||||
*/
|
||||
#[DataProvider('invalidCreatDataProvider')]
|
||||
public function testCreatInvalidData(string $date, string $time): void
|
||||
public function testCreatInvalidData(string $date, string $time, bool $isHomeOffice = false): void
|
||||
{
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => $date,
|
||||
'workingTime' => $time,
|
||||
'workingDay' => $date,
|
||||
'workingTime' => $time,
|
||||
'isHomeOfficeDay' => $isHomeOffice,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
@@ -325,8 +349,29 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
{
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::NEW_DATE,
|
||||
'workingTime' => self::NEW_INTERVAL,
|
||||
'workingDay' => self::NEW_DATE,
|
||||
'workingTime' => self::NEW_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
$response = $controller->creat($this->request, $this->response, []);
|
||||
$this->assertEquals(self::FICTIONAL_STATUS_CODE, $response->getStatusCode());
|
||||
$this->assertNotEmpty($response->getBody()->getContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotDatabasesException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function testCreatNewRecordWithoutHomeOffice(): void
|
||||
{
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::NEW_DATE,
|
||||
'workingTime' => self::NEW_INTERVAL,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
@@ -345,8 +390,9 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
{
|
||||
$this->request = $this->makeEmpty(Request::class, [
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
|
||||
Reference in New Issue
Block a user