home-office #32

Merged
TorstenHettstedt merged 8 commits from home-office into master 2025-06-27 11:43:57 +02:00
2 changed files with 20 additions and 51 deletions
Showing only changes of commit 4d91a04430 - Show all commits
+2 -31
View File
@@ -21,12 +21,6 @@ class WorkingHoursController extends AbstractController
{ {
/** /**
* @param Request $request
* @param Response $response
* @param array<string, mixed> $args
*
* @return Response
*
* @throws HttpBadRequestException * @throws HttpBadRequestException
* @throws HttpNotFoundException * @throws HttpNotFoundException
*/ */
@@ -34,7 +28,7 @@ class WorkingHoursController extends AbstractController
{ {
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$repository = new WorkingHoursRepository($this->databases); $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 { try {
$repository->update($model); $repository->update($model);
} catch (RepositoryRecordNotFoundException $exception) { } 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 HttpInternalServerErrorException
* @throws HttpBadRequestException * @throws HttpBadRequestException
* @noinspection PhpUnusedParameterInspection * @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 HttpNotFoundException
* @throws HttpInternalServerErrorException * @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 HttpBadRequestException
* @throws HttpConflictRequestException * @throws HttpConflictRequestException
* @throws HttpInternalServerErrorException * @throws HttpInternalServerErrorException
@@ -124,7 +100,7 @@ class WorkingHoursController extends AbstractController
$request, $request,
$body['workingDay'], $body['workingDay'],
$body['workingTime'], $body['workingTime'],
$body['isHomeOfficeDay'] ?? false $body['isHomeOffice'] ?? false
); );
try { try {
$repository->insert($model); $repository->insert($model);
@@ -141,11 +117,6 @@ class WorkingHoursController extends AbstractController
} }
/** /**
* @param Request $request
* @param string $date
* @param string $time
*
* @return WorkingHours
* @throws HttpBadRequestException * @throws HttpBadRequestException
*/ */
protected function buildModel(Request $request, string $date, string $time, bool $isHomeOffice): WorkingHours 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 Codeception\Attribute\DataProvider;
use Exception; use Exception;
use PHPUnit\Framework\MockObject\Exception as MockException;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@@ -25,7 +26,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
/** /**
* @throws Exception * @throws Exception
* @throws \PHPUnit\Framework\MockObject\Exception * @throws MockException
*/ */
protected function _before(): void protected function _before(): void
{ {
@@ -34,7 +35,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
'getParsedBody' => [ 'getParsedBody' => [
'workingDay' => self::EXISTING_DATE, 'workingDay' => self::EXISTING_DATE,
'workingTime' => self::EXISTING_INTERVAL, '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 ContainerExceptionInterface
* @throws NotDatabasesException * @throws NotDatabasesException
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
@@ -331,7 +329,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
'getParsedBody' => [ 'getParsedBody' => [
'workingDay' => $date, 'workingDay' => $date,
'workingTime' => $time, 'workingTime' => $time,
'isHomeOfficeDay' => $isHomeOffice, 'isHomeOffice' => $isHomeOffice,
], ],
]); ]);
$controller = new WorkingHoursController($this->container); $controller = new WorkingHoursController($this->container);
@@ -351,7 +349,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
'getParsedBody' => [ 'getParsedBody' => [
'workingDay' => self::NEW_DATE, 'workingDay' => self::NEW_DATE,
'workingTime' => self::NEW_INTERVAL, 'workingTime' => self::NEW_INTERVAL,
'isHomeOfficeDay' => true, 'isHomeOffice' => true,
], ],
]); ]);
$controller = new WorkingHoursController($this->container); $controller = new WorkingHoursController($this->container);
@@ -392,7 +390,7 @@ class WorkingHoursControllerTest extends AbstractControllerTest
'getParsedBody' => [ 'getParsedBody' => [
'workingDay' => self::EXISTING_DATE, 'workingDay' => self::EXISTING_DATE,
'workingTime' => self::EXISTING_INTERVAL, 'workingTime' => self::EXISTING_INTERVAL,
'isHomeOfficeDay' => true, 'isHomeOffice' => true,
], ],
]); ]);
$controller = new WorkingHoursController($this->container); $controller = new WorkingHoursController($this->container);