From e5f262869ca252d22cc2ad49f779c55bfe3901e4 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 6 Dec 2019 23:40:27 +0100 Subject: [PATCH] Improved tag conflict docs and tests --- docs/swagger/paths/v1_tags.json | 10 +++++++ .../Exception/TagConflictExceptionTest.php | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 module/Core/test/Exception/TagConflictExceptionTest.php diff --git a/docs/swagger/paths/v1_tags.json b/docs/swagger/paths/v1_tags.json index da0159bd..a0fcc512 100644 --- a/docs/swagger/paths/v1_tags.json +++ b/docs/swagger/paths/v1_tags.json @@ -229,6 +229,16 @@ } } }, + "409": { + "description": "The name provided in newName param is already in use for another tag.", + "content": { + "application/problem+json": { + "schema": { + "$ref": "../definitions/Error.json" + } + } + } + }, "500": { "description": "Unexpected error.", "content": { diff --git a/module/Core/test/Exception/TagConflictExceptionTest.php b/module/Core/test/Exception/TagConflictExceptionTest.php new file mode 100644 index 00000000..f09e3a32 --- /dev/null +++ b/module/Core/test/Exception/TagConflictExceptionTest.php @@ -0,0 +1,29 @@ +assertEquals($expectedMessage, $e->getMessage()); + $this->assertEquals($expectedMessage, $e->getDetail()); + $this->assertEquals('Tag conflict', $e->getTitle()); + $this->assertEquals('TAG_CONFLICT', $e->getType()); + $this->assertEquals(['oldName' => $oldName, 'newName' => $newName], $e->getAdditionalData()); + $this->assertEquals(409, $e->getStatus()); + } +}