fix sharing trashbin integration tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-09-12 15:28:03 +02:00
parent 073fddcc28
commit d890cd6a4c
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
2 changed files with 23 additions and 3 deletions

View File

@ -118,6 +118,26 @@ trait Trashbin {
} }
} }
/**
* @Then /^as "([^"]*)" the (file|folder) "([^"]*)" exists in trash$/
* @param string $user
* @param string $type
* @param string $file
*/
public function checkTrashContains($user, $type, $file) {
$parent = dirname($file);
if ($parent === '.') {
$parent = '/';
}
$name = basename($file);
$elementList = $this->listTrashbinFolder($user, $parent);
$trashContent = array_filter(array_map(function (array $item) {
return $item['{http://nextcloud.org/ns}trashbin-filename'];
}, $elementList));
Assert::assertArraySubset([$name], array_values($trashContent));
}
/** /**
* @Then /^user "([^"]*)" in trash folder "([^"]*)" should have (\d+) elements?$/ * @Then /^user "([^"]*)" in trash folder "([^"]*)" should have (\d+) elements?$/
* @param string $user * @param string $user

View File

@ -1,7 +1,7 @@
Feature: sharing Feature: sharing
Background: Background:
Given using api version "1" Given using api version "1"
Given using old dav path Given using new dav path
# See sharing-v1-part2.feature # See sharing-v1-part2.feature
@ -295,7 +295,7 @@ Feature: sharing
And user "user0" exists And user "user0" exists
And User "user0" deletes file "/textfile0.txt" And User "user0" deletes file "/textfile0.txt"
When User "user0" empties trashbin When User "user0" empties trashbin
Then the HTTP status code should be "200" Then the HTTP status code should be "204"
Scenario: orphaned shares Scenario: orphaned shares
Given As an "admin" Given As an "admin"
@ -392,4 +392,4 @@ Feature: sharing
And folder "/shared" of user "user0" is shared with user "user1" And folder "/shared" of user "user0" is shared with user "user1"
When User "user1" moved file "/textfile0.txt" to "/shared/shared_file.txt" When User "user1" moved file "/textfile0.txt" to "/shared/shared_file.txt"
Then as "user1" the file "/shared/shared_file.txt" exists Then as "user1" the file "/shared/shared_file.txt" exists
And as "user0" the file "/shared/shared_file.txt" exists And as "user0" the file "/shared/shared_file.txt" exists