From bb9f5686543531ccb55a59eb003cd6f83991b398 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Tue, 6 Oct 2015 16:37:55 +0000 Subject: [PATCH] lists getting ready --- .../features/bootstrap/FeatureContext.php | 37 +++++++++++++++++++ .../features/provisioning-v1.feature | 7 ++++ 2 files changed, 44 insertions(+) diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 9676fc8ca4..99d030fa6f 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -58,6 +58,43 @@ class FeatureContext extends BehatContext { return $response->xml()->meta[0]->statuscode; } + /** + * Parses the xml answer to get the array of users returned. + */ + public function getArrayOfUsersResponded($resp) { + $listCheckedElements = $resp->xml()->data[0]->users[0]->element; + $extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1); + return $extractedElementsArray; + } + + + /** + * Parses the xml answer to get the array of groups returned. + */ + /* + public function getArrayOfGroupsResponded(){ + $listCheckedElements = $this->$response->xml()->data[0]->groups[0]->element; + $extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1); + return $extractedElementsArray; + } + */ + + + + /** + * @Then /^users returned are$/ + * @param \Behat\Gherkin\Node\TableNode|null $formData + */ + public function theUsersShouldBe($usersList) { + if ($usersList instanceof \Behat\Gherkin\Node\TableNode) { + $users = $usersList->getRows()[0]; + $respondedArray = $this->getArrayOfUsersResponded($this->response); + PHPUnit_Framework_Assert::assertEquals($users, $respondedArray); + } + + } + + /** * @Then /^the OCS status code should be "([^"]*)"$/ */ diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature index 823fd823c5..448c06b8b5 100644 --- a/build/integration/features/provisioning-v1.feature +++ b/build/integration/features/provisioning-v1.feature @@ -40,6 +40,13 @@ Feature: provisioning And the HTTP status code should be "200" + Scenario: Getting all users + Given As an "admin" + When sending "GET" to "/cloud/users" + And users returned are + | brand-new-user | ser507 | + + Scenario: Edit a user Given As an "admin" And user "brand-new-user" exists