tests(integration): Add test for multiple board shares to the same user
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -90,3 +90,19 @@ Feature: acl
|
||||
And the current user should not have "edit" permissions on the board
|
||||
And the current user should have "share" permissions on the board
|
||||
And the current user should not have "manage" permissions on the board
|
||||
|
||||
Scenario: Share a board multiple times
|
||||
Given Logging in using web as "user0"
|
||||
And creates a board named "Double shared board" with color "ff0000"
|
||||
And shares the board with user "user1"
|
||||
And shares the board with group "group1"
|
||||
And creates a board named "Single shared board" with color "00ff00"
|
||||
And shares the board with user "user1"
|
||||
When Logging in using web as "user1"
|
||||
And fetching the board list
|
||||
Then the response should have a status code "200"
|
||||
And the response should be a list of objects
|
||||
And the response should contain an element with the properties
|
||||
| property | value |
|
||||
| title | Double shared board |
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user