tests: Fix missing behat context methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -158,7 +158,6 @@ class PermissionService {
|
|||||||
|
|
||||||
$permissions = $this->getPermissions($boardId, $userId);
|
$permissions = $this->getPermissions($boardId, $userId);
|
||||||
if ($permissions[$permission] === true) {
|
if ($permissions[$permission] === true) {
|
||||||
|
|
||||||
if (!$allowDeletedCard && $mapper instanceof CardMapper) {
|
if (!$allowDeletedCard && $mapper instanceof CardMapper) {
|
||||||
$card = $mapper->find($id);
|
$card = $mapper->find($id);
|
||||||
if ($card->getDeletedAt() > 0) {
|
if ($card->getDeletedAt() > 0) {
|
||||||
|
|||||||
@@ -302,6 +302,4 @@ class BoardContext implements Context {
|
|||||||
public function theFetchedActivitiesShouldHaveEntries($count) {
|
public function theFetchedActivitiesShouldHaveEntries($count) {
|
||||||
Assert::assertEquals($count, count($this->activities ?? []));
|
Assert::assertEquals($count, count($this->activities ?? []));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,5 +58,4 @@ class CommentContext implements Context {
|
|||||||
$card = $this->boardContext->getLastUsedCard();
|
$card = $this->boardContext->getLastUsedCard();
|
||||||
$this->requestContext->sendOCSRequest('DELETE', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments/'. $this->lastComment['id']);
|
$this->requestContext->sendOCSRequest('DELETE', '/apps/deck/api/v1.0/cards/' . $card['id'] . '/comments/'. $this->lastComment['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,4 +166,29 @@ class RequestContext implements Context {
|
|||||||
$this->getResponse()->getBody()->seek(0);
|
$this->getResponse()->getBody()->seek(0);
|
||||||
return json_decode((string)$this->getResponse()->getBody(), true);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user