Erweitere die Tests
This commit is contained in:
@@ -21,12 +21,6 @@ class WorkingHoursController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
* @param array<string, mixed> $args
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws HttpBadRequestException
|
||||
* @throws HttpNotFoundException
|
||||
*/
|
||||
@@ -34,7 +28,7 @@ class WorkingHoursController extends AbstractController
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$repository = new WorkingHoursRepository($this->databases);
|
||||
$model = $this->buildModel($request, $args['id'], $body['workingTime'], $body['isHomeOfficeDay'] ?? false);
|
||||
$model = $this->buildModel($request, $args['id'], $body['workingTime'], $body['isHomeOffice'] ?? false);
|
||||
try {
|
||||
$repository->update($model);
|
||||
} catch (RepositoryRecordNotFoundException $exception) {
|
||||
@@ -44,12 +38,6 @@ class WorkingHoursController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
* @param array<string, mixed> $args
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws HttpInternalServerErrorException
|
||||
* @throws HttpBadRequestException
|
||||
* @noinspection PhpUnusedParameterInspection
|
||||
@@ -79,12 +67,6 @@ class WorkingHoursController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
* @param array<string, mixed> $args
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws HttpNotFoundException
|
||||
* @throws HttpInternalServerErrorException
|
||||
*/
|
||||
@@ -105,12 +87,6 @@ class WorkingHoursController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
* @param array<string, mixed> $args
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws HttpBadRequestException
|
||||
* @throws HttpConflictRequestException
|
||||
* @throws HttpInternalServerErrorException
|
||||
@@ -124,7 +100,7 @@ class WorkingHoursController extends AbstractController
|
||||
$request,
|
||||
$body['workingDay'],
|
||||
$body['workingTime'],
|
||||
$body['isHomeOfficeDay'] ?? false
|
||||
$body['isHomeOffice'] ?? false
|
||||
);
|
||||
try {
|
||||
$repository->insert($model);
|
||||
@@ -141,11 +117,6 @@ class WorkingHoursController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param string $date
|
||||
* @param string $time
|
||||
*
|
||||
* @return WorkingHours
|
||||
* @throws HttpBadRequestException
|
||||
*/
|
||||
protected function buildModel(Request $request, string $date, string $time, bool $isHomeOffice): WorkingHours
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace TorstenHettstedt\TimekeepingApi\Tests\Unit\Controller;
|
||||
|
||||
use Codeception\Attribute\DataProvider;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\MockObject\Exception as MockException;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -25,7 +26,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PHPUnit\Framework\MockObject\Exception
|
||||
* @throws MockException
|
||||
*/
|
||||
protected function _before(): void
|
||||
{
|
||||
@@ -34,7 +35,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
'isHomeOffice' => true,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -316,9 +317,6 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $date
|
||||
* @param string $time
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotDatabasesException
|
||||
* @throws NotFoundExceptionInterface
|
||||
@@ -331,7 +329,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
'getParsedBody' => [
|
||||
'workingDay' => $date,
|
||||
'workingTime' => $time,
|
||||
'isHomeOfficeDay' => $isHomeOffice,
|
||||
'isHomeOffice' => $isHomeOffice,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
@@ -351,7 +349,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::NEW_DATE,
|
||||
'workingTime' => self::NEW_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
'isHomeOffice' => true,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
@@ -392,7 +390,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
|
||||
'getParsedBody' => [
|
||||
'workingDay' => self::EXISTING_DATE,
|
||||
'workingTime' => self::EXISTING_INTERVAL,
|
||||
'isHomeOfficeDay' => true,
|
||||
'isHomeOffice' => true,
|
||||
],
|
||||
]);
|
||||
$controller = new WorkingHoursController($this->container);
|
||||
|
||||
Reference in New Issue
Block a user