diff --git a/api/src/Controller/WorkingHoursController.php b/api/src/Controller/WorkingHoursController.php index 1e50332..539da32 100644 --- a/api/src/Controller/WorkingHoursController.php +++ b/api/src/Controller/WorkingHoursController.php @@ -21,12 +21,6 @@ class WorkingHoursController extends AbstractController { /** - * @param Request $request - * @param Response $response - * @param array $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 $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 $args - * - * @return Response - * * @throws HttpNotFoundException * @throws HttpInternalServerErrorException */ @@ -105,12 +87,6 @@ class WorkingHoursController extends AbstractController } /** - * @param Request $request - * @param Response $response - * @param array $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 diff --git a/api/tests/unit/Controller/WorkingHoursControllerTest.php b/api/tests/unit/Controller/WorkingHoursControllerTest.php index 845f381..3e2919a 100644 --- a/api/tests/unit/Controller/WorkingHoursControllerTest.php +++ b/api/tests/unit/Controller/WorkingHoursControllerTest.php @@ -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,16 +26,16 @@ class WorkingHoursControllerTest extends AbstractControllerTest /** * @throws Exception - * @throws \PHPUnit\Framework\MockObject\Exception + * @throws MockException */ protected function _before(): void { parent::_before(); $this->request = $this->makeEmpty(Request::class, [ 'getParsedBody' => [ - 'workingDay' => self::EXISTING_DATE, - 'workingTime' => self::EXISTING_INTERVAL, - 'isHomeOfficeDay' => true, + 'workingDay' => self::EXISTING_DATE, + 'workingTime' => self::EXISTING_INTERVAL, + 'isHomeOffice' => true, ], ]); } @@ -271,8 +272,8 @@ 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, ], ]); $controller = new WorkingHoursController($this->container); @@ -316,9 +317,6 @@ class WorkingHoursControllerTest extends AbstractControllerTest } /** - * @param string $date - * @param string $time - * * @throws ContainerExceptionInterface * @throws NotDatabasesException * @throws NotFoundExceptionInterface @@ -329,9 +327,9 @@ class WorkingHoursControllerTest extends AbstractControllerTest { $this->request = $this->makeEmpty(Request::class, [ 'getParsedBody' => [ - 'workingDay' => $date, - 'workingTime' => $time, - 'isHomeOfficeDay' => $isHomeOffice, + 'workingDay' => $date, + 'workingTime' => $time, + 'isHomeOffice' => $isHomeOffice, ], ]); $controller = new WorkingHoursController($this->container); @@ -349,9 +347,9 @@ class WorkingHoursControllerTest extends AbstractControllerTest { $this->request = $this->makeEmpty(Request::class, [ 'getParsedBody' => [ - 'workingDay' => self::NEW_DATE, - 'workingTime' => self::NEW_INTERVAL, - 'isHomeOfficeDay' => true, + 'workingDay' => self::NEW_DATE, + 'workingTime' => self::NEW_INTERVAL, + 'isHomeOffice' => true, ], ]); $controller = new WorkingHoursController($this->container); @@ -370,8 +368,8 @@ 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, ], ]); $controller = new WorkingHoursController($this->container); @@ -390,9 +388,9 @@ class WorkingHoursControllerTest extends AbstractControllerTest { $this->request = $this->makeEmpty(Request::class, [ 'getParsedBody' => [ - 'workingDay' => self::EXISTING_DATE, - 'workingTime' => self::EXISTING_INTERVAL, - 'isHomeOfficeDay' => true, + 'workingDay' => self::EXISTING_DATE, + 'workingTime' => self::EXISTING_INTERVAL, + 'isHomeOffice' => true, ], ]); $controller = new WorkingHoursController($this->container);