Die Namen der Eigenschaften waren nicht perfekt.

This commit is contained in:
2021-04-06 19:56:41 +02:00
parent ac99e079ee
commit 4871ff14dc
4 changed files with 20 additions and 17 deletions
+5 -3
View File
@@ -82,6 +82,7 @@
"tags": [ "tags": [
"Eintragungen Arbeitszeiten" "Eintragungen Arbeitszeiten"
], ],
"description": "Angabe des Datum im Request-Body werden ignoriert",
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/date" "$ref": "#/components/parameters/date"
@@ -167,12 +168,13 @@
"description": "Eintrag der Arbeitszeit für einen Tag", "description": "Eintrag der Arbeitszeit für einen Tag",
"type": "object", "type": "object",
"properties": { "properties": {
"date": { "workingDay": {
"description": "Datum eines Arbeitstages", "description": "Datum eines Arbeitstages",
"type": "string", "type": "string",
"format": "date" "format": "date",
"required": false
}, },
"workingHours": { "workingTime": {
"description": "Arbeitszeit des Tages", "description": "Arbeitszeit des Tages",
"type": "string", "type": "string",
"pattern": "[0-5]\\d:[0-5]\\d:[0-5]\\d", "pattern": "[0-5]\\d:[0-5]\\d:[0-5]\\d",
+3 -2
View File
@@ -10,10 +10,11 @@ class Api extends Module
{ {
const FORMAT_TIME = 'string:regex(/\d+:[0-5]\d:[0-5]\d/)'; 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 = [ const WORKING_HOURS_JSON_FORMAT = [
'date' => 'string:date', 'workingDay' => self::FORMAT_DATE,
'workingHours' => self::FORMAT_TIME, 'workingTime' => self::FORMAT_TIME,
]; ];
const WORKING_HOURS_VIEW_JSON_FORMAT = [ const WORKING_HOURS_VIEW_JSON_FORMAT = [
@@ -13,8 +13,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [ $I->sendPost('/working-hours', [
'date' => '2020-04-01', 'workingDay' => '2020-04-01',
'workingHours' => '08:00:00', 'workingTime' => '08:00:00',
]); ]);
$I->seeResponseCodeIs(HttpCode::CREATED); $I->seeResponseCodeIs(HttpCode::CREATED);
$I->seeResponseIsJson(); $I->seeResponseIsJson();
@@ -27,8 +27,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [ $I->sendPost('/working-hours', [
'date' => '2020-04-01', 'workingDay' => '2020-04-01',
'workingHours' => 8.0, 'workingTime' => 8.0,
]); ]);
$I->seeResponseCodeIs(HttpCode::BAD_REQUEST); $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);
$I->seeResponseIsJson(); $I->seeResponseIsJson();
@@ -41,8 +41,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [ $I->sendPost('/working-hours', [
'date' => '2020-01-15', 'workingDay' => '2020-01-15',
'workingHours' => '08:00:00', 'workingTime' => '08:00:00',
]); ]);
$I->seeResponseCodeIs(HttpCode::CONFLICT); $I->seeResponseCodeIs(HttpCode::CONFLICT);
$I->seeResponseIsJson(); $I->seeResponseIsJson();
@@ -13,8 +13,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [ $I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-01-15', 'workingDay' => '2020-01-15',
'workingHours' => '10:00:00', 'workingTime' => '10:00:00',
]); ]);
$I->seeResponseCodeIs(HttpCode::OK); $I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseIsJson(); $I->seeResponseIsJson();
@@ -26,8 +26,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [ $I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-04-15', 'workingDay' => '2020-04-15',
'workingHours' => '10:00:00', 'workingTime' => '10:00:00',
]); ]);
$I->seeResponseCodeIs(HttpCode::NOT_FOUND); $I->seeResponseCodeIs(HttpCode::NOT_FOUND);
$I->seeResponseIsJson(); $I->seeResponseIsJson();
@@ -39,8 +39,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json'); $I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json'); $I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [ $I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-01-15', 'workingDay' => '2020-01-15',
'workingHours' => 8.0, 'workingTime' => 8.0,
]); ]);
$I->seeResponseCodeIs(HttpCode::BAD_REQUEST); $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);
$I->seeResponseIsJson(); $I->seeResponseIsJson();