diff options
author | Sergio Bertolin <sbertolin@solidgear.es> | 2015-11-10 10:22:38 +0000 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-10 16:25:34 +0100 |
commit | 7aa6e9b6432462da606b12058297fda7fba56fe3 (patch) | |
tree | c459168f16e97c3f1ca8b6984c205bc18d5e24f9 /build/integration/features/bootstrap/FeatureContext.php | |
parent | e4900c6c4c7f28261cceb7e6ddc30bce5bc87bd4 (diff) | |
download | nextcloud-server-7aa6e9b6432462da606b12058297fda7fba56fe3.tar.gz nextcloud-server-7aa6e9b6432462da606b12058297fda7fba56fe3.zip |
Added test to get info of a specific share id
Check fields of the share response
Added missing fields to check if their values are numbers
Diffstat (limited to 'build/integration/features/bootstrap/FeatureContext.php')
-rw-r--r-- | build/integration/features/bootstrap/FeatureContext.php | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 69fa018d0e6..4a0299d6e49 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -672,7 +672,10 @@ class FeatureContext implements Context, SnippetAcceptingContext { public function isFieldInResponse($field, $content_expected){ $data = $this->response->xml()->data[0]; foreach($data as $element) { - if ($element->$field == $content_expected){ + if ($content_expected == "A_NUMBER"){ + return is_numeric((string)$element->$field); + } + elseif ($element->$field == $content_expected){ return True; } } @@ -744,10 +747,32 @@ class FeatureContext implements Context, SnippetAcceptingContext { */ public function deletingLastShare(){ $share_id = $this->lastShareData->data[0]->id; - $url = "/apps/files_sharing/api/v{$this->apiVersion}/shares/$share_id"; + $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $this->sendingToWith("DELETE", $url, null); } + /** + * @When /^Getting info of last share$/ + */ + public function gettingInfoOfLastShare(){ + $share_id = $this->lastShareData->data[0]->id; + $url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; + $this->sendingToWith("GET", $url, null); + } + + /** + * @Then /^Share fields of last share match with$/ + * @param \Behat\Gherkin\Node\TableNode|null $formData + */ + public function checkShareFields($body){ + if ($body instanceof \Behat\Gherkin\Node\TableNode) { + $fd = $body->getRowsHash(); + foreach($fd as $field => $value) { + PHPUnit_Framework_Assert::assertEquals(True, $this->isFieldInResponse($field, $value)); + } + } + } + public static function removeFile($path, $filename){ if (file_exists("$path" . "$filename")) { unlink("$path" . "$filename"); |