diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php index bb66631e7..e573c0257 100644 --- a/lib/Service/PermissionService.php +++ b/lib/Service/PermissionService.php @@ -159,7 +159,6 @@ class PermissionService { $permissions = $this->getPermissions($boardId, $userId); if ($permissions[$permission] === true) { - if (!$allowDeletedCard && $mapper instanceof CardMapper) { $card = $mapper->find($id); if ($card->getDeletedAt() > 0) { diff --git a/tests/integration/features/bootstrap/BoardContext.php b/tests/integration/features/bootstrap/BoardContext.php index 09d05fa30..45038de64 100644 --- a/tests/integration/features/bootstrap/BoardContext.php +++ b/tests/integration/features/bootstrap/BoardContext.php @@ -320,6 +320,4 @@ class BoardContext implements Context { public function theFetchedActivitiesShouldHaveEntries($count) { Assert::assertEquals($count, count($this->activities ?? [])); } - - } diff --git a/tests/integration/features/bootstrap/CommentContext.php b/tests/integration/features/bootstrap/CommentContext.php index 92bc9a347..aba5a6065 100644 --- a/tests/integration/features/bootstrap/CommentContext.php +++ b/tests/integration/features/bootstrap/CommentContext.php @@ -58,5 +58,4 @@ class CommentContext implements Context { $card = $this->boardContext->getLastUsedCard(); $this->requestContext->sendOCSRequest('DELETE', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments/'. $this->lastComment['id']); } - } diff --git a/tests/integration/features/bootstrap/RequestContext.php b/tests/integration/features/bootstrap/RequestContext.php index 9df6be205..ebf01e80a 100644 --- a/tests/integration/features/bootstrap/RequestContext.php +++ b/tests/integration/features/bootstrap/RequestContext.php @@ -166,4 +166,29 @@ class RequestContext implements Context { $this->getResponse()->getBody()->seek(0); return json_decode((string)$this->getResponse()->getBody(), true); } + + /** + * @Given /^the response should be a list of objects$/ + */ + public function theResponseShouldBeAListOfObjects() { + $jsonResponse = $this->getResponseBodyFromJson(); + Assert::assertEquals(array_keys($jsonResponse), range(0, count($jsonResponse) - 1)); + } + + /** + * @When /^the response should contain an element with the properties$/ + */ + public function responseContainsElement(TableNode $element) { + $json = $this->getResponseBodyFromJson(); + $found = array_filter($json, function ($board) use ($element) { + foreach ($element as $row) { + if ($row['value'] !== $board[$row['property']]) { + return false; + } + } + + return true; + }); + Assert::assertEquals(1, count($found)); + } } diff --git a/tests/integration/features/decks.feature b/tests/integration/features/decks.feature index 0351f6269..1913c8420 100644 --- a/tests/integration/features/decks.feature +++ b/tests/integration/features/decks.feature @@ -33,32 +33,6 @@ Feature: decks And create a stack named "ToDo" When create a card named "This is a very ong name that exceeds the maximum length of a deck board created which is longer than 255 characters This is a very ong name that exceeds the maximum length of a deck board created which is longer than 255 characters This is a very ong name that exceeds the maximum length of a deck board created which is longer than 255 characters" - Scenario: Setting a duedate on a card - Given acting as user "user0" - And creates a board named "MyBoard" with color "000000" - And create a stack named "ToDo" - And create a card named "Overdue task" - When get the card details - And the response should be a JSON array with the following mandatory values - |key|value| - |title|Overdue task| - |duedate|| - |overdue|0| - And set the card attribute "duedate" to "2020-12-12 13:37:00" - When get the card details - And the response should be a JSON array with the following mandatory values - |key|value| - |title|Overdue task| - |duedate|2020-12-12T13:37:00+00:00| - |overdue|3| - And set the card attribute "duedate" to "" - When get the card details - And the response should be a JSON array with the following mandatory values - |key|value| - |title|Overdue task| - |duedate|| - |overdue|0| - Scenario: Cannot access card on a deleted board Given acting as user "user0" And creates a board named "MyBoard" with color "000000"