From 4871ff14dce5ff77c804f4fa32888bbeac3f914a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20L=C3=BCcke?= Date: Tue, 6 Apr 2021 19:56:41 +0200 Subject: [PATCH] Die Namen der Eigenschaften waren nicht perfekt. --- api/html/openapi.json | 8 +++++--- api/tests/_support/Helper/Api.php | 5 +++-- .../api/WorkingHours/CreateWorkingHoursCest.php | 12 ++++++------ .../api/WorkingHours/UpdateWorkingHoursCest.php | 12 ++++++------ 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/api/html/openapi.json b/api/html/openapi.json index d04650a..f371e8b 100644 --- a/api/html/openapi.json +++ b/api/html/openapi.json @@ -82,6 +82,7 @@ "tags": [ "Eintragungen Arbeitszeiten" ], + "description": "Angabe des Datum im Request-Body werden ignoriert", "parameters": [ { "$ref": "#/components/parameters/date" @@ -167,12 +168,13 @@ "description": "Eintrag der Arbeitszeit für einen Tag", "type": "object", "properties": { - "date": { + "workingDay": { "description": "Datum eines Arbeitstages", "type": "string", - "format": "date" + "format": "date", + "required": false }, - "workingHours": { + "workingTime": { "description": "Arbeitszeit des Tages", "type": "string", "pattern": "[0-5]\\d:[0-5]\\d:[0-5]\\d", diff --git a/api/tests/_support/Helper/Api.php b/api/tests/_support/Helper/Api.php index d257c14..86011e9 100644 --- a/api/tests/_support/Helper/Api.php +++ b/api/tests/_support/Helper/Api.php @@ -10,10 +10,11 @@ class Api extends Module { const FORMAT_TIME = 'string:regex(/\d+:[0-5]\d:[0-5]\d/)'; + const FORMAT_DATE = 'string:regex(/\d{4}-\d{2}-\d{2}/)'; const WORKING_HOURS_JSON_FORMAT = [ - 'date' => 'string:date', - 'workingHours' => self::FORMAT_TIME, + 'workingDay' => self::FORMAT_DATE, + 'workingTime' => self::FORMAT_TIME, ]; const WORKING_HOURS_VIEW_JSON_FORMAT = [ diff --git a/api/tests/api/WorkingHours/CreateWorkingHoursCest.php b/api/tests/api/WorkingHours/CreateWorkingHoursCest.php index 425a8e9..725b895 100644 --- a/api/tests/api/WorkingHours/CreateWorkingHoursCest.php +++ b/api/tests/api/WorkingHours/CreateWorkingHoursCest.php @@ -13,8 +13,8 @@ class CreateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPost('/working-hours', [ - 'date' => '2020-04-01', - 'workingHours' => '08:00:00', + 'workingDay' => '2020-04-01', + 'workingTime' => '08:00:00', ]); $I->seeResponseCodeIs(HttpCode::CREATED); $I->seeResponseIsJson(); @@ -27,8 +27,8 @@ class CreateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPost('/working-hours', [ - 'date' => '2020-04-01', - 'workingHours' => 8.0, + 'workingDay' => '2020-04-01', + 'workingTime' => 8.0, ]); $I->seeResponseCodeIs(HttpCode::BAD_REQUEST); $I->seeResponseIsJson(); @@ -41,8 +41,8 @@ class CreateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPost('/working-hours', [ - 'date' => '2020-01-15', - 'workingHours' => '08:00:00', + 'workingDay' => '2020-01-15', + 'workingTime' => '08:00:00', ]); $I->seeResponseCodeIs(HttpCode::CONFLICT); $I->seeResponseIsJson(); diff --git a/api/tests/api/WorkingHours/UpdateWorkingHoursCest.php b/api/tests/api/WorkingHours/UpdateWorkingHoursCest.php index 3eae5f3..880a137 100644 --- a/api/tests/api/WorkingHours/UpdateWorkingHoursCest.php +++ b/api/tests/api/WorkingHours/UpdateWorkingHoursCest.php @@ -13,8 +13,8 @@ class UpdateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPut('/working-hours/2020-01-15', [ - 'date' => '2020-01-15', - 'workingHours' => '10:00:00', + 'workingDay' => '2020-01-15', + 'workingTime' => '10:00:00', ]); $I->seeResponseCodeIs(HttpCode::OK); $I->seeResponseIsJson(); @@ -26,8 +26,8 @@ class UpdateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPut('/working-hours/2020-01-15', [ - 'date' => '2020-04-15', - 'workingHours' => '10:00:00', + 'workingDay' => '2020-04-15', + 'workingTime' => '10:00:00', ]); $I->seeResponseCodeIs(HttpCode::NOT_FOUND); $I->seeResponseIsJson(); @@ -39,8 +39,8 @@ class UpdateWorkingHoursCest $I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('content-type', 'application/json'); $I->sendPut('/working-hours/2020-01-15', [ - 'date' => '2020-01-15', - 'workingHours' => 8.0, + 'workingDay' => '2020-01-15', + 'workingTime' => 8.0, ]); $I->seeResponseCodeIs(HttpCode::BAD_REQUEST); $I->seeResponseIsJson();