changing indentation, vertical elements and previous existance of users and groups
This commit is contained in:
parent
957d60cd0a
commit
8f91426e0a
|
@ -58,22 +58,22 @@ class FeatureContext extends BehatContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the xml answer to get the array of users returned.
|
* Parses the xml answer to get the array of users returned.
|
||||||
*/
|
*/
|
||||||
public function getArrayOfUsersResponded($resp) {
|
public function getArrayOfUsersResponded($resp) {
|
||||||
$listCheckedElements = $resp->xml()->data[0]->users[0]->element;
|
$listCheckedElements = $resp->xml()->data[0]->users[0]->element;
|
||||||
$extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1);
|
$extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1);
|
||||||
return $extractedElementsArray;
|
return $extractedElementsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the xml answer to get the array of groups returned.
|
* Parses the xml answer to get the array of groups returned.
|
||||||
*/
|
*/
|
||||||
public function getArrayOfGroupsResponded($resp) {
|
public function getArrayOfGroupsResponded($resp) {
|
||||||
$listCheckedElements = $resp->xml()->data[0]->groups[0]->element;
|
$listCheckedElements = $resp->xml()->data[0]->groups[0]->element;
|
||||||
$extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1);
|
$extractedElementsArray = json_decode( json_encode($listCheckedElements) , 1);
|
||||||
return $extractedElementsArray;
|
return $extractedElementsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then /^users returned are$/
|
* @Then /^users returned are$/
|
||||||
|
@ -82,8 +82,8 @@ class FeatureContext extends BehatContext {
|
||||||
public function theUsersShouldBe($usersList) {
|
public function theUsersShouldBe($usersList) {
|
||||||
if ($usersList instanceof \Behat\Gherkin\Node\TableNode) {
|
if ($usersList instanceof \Behat\Gherkin\Node\TableNode) {
|
||||||
$users = $usersList->getRows()[0];
|
$users = $usersList->getRows()[0];
|
||||||
$respondedArray = $this->getArrayOfUsersResponded($this->response);
|
$respondedArray = $this->getArrayOfUsersResponded($this->response);
|
||||||
PHPUnit_Framework_Assert::assertEquals(asort($users), asort($respondedArray));
|
PHPUnit_Framework_Assert::assertEquals(asort($users), asort($respondedArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ class FeatureContext extends BehatContext {
|
||||||
public function theGroupsShouldBe($groupsList) {
|
public function theGroupsShouldBe($groupsList) {
|
||||||
if ($groupsList instanceof \Behat\Gherkin\Node\TableNode) {
|
if ($groupsList instanceof \Behat\Gherkin\Node\TableNode) {
|
||||||
$groups = $groupsList->getRows()[0];
|
$groups = $groupsList->getRows()[0];
|
||||||
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
|
$respondedArray = $this->getArrayOfGroupsResponded($this->response);
|
||||||
PHPUnit_Framework_Assert::assertEquals(asort($groups), asort($respondedArray));
|
PHPUnit_Framework_Assert::assertEquals(asort($groups), asort($respondedArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,12 @@ Feature: provisioning
|
||||||
|
|
||||||
Scenario: Getting all users
|
Scenario: Getting all users
|
||||||
Given As an "admin"
|
Given As an "admin"
|
||||||
|
And user "brand-new-user" exists
|
||||||
|
And user "admin" exists
|
||||||
When sending "GET" to "/cloud/users"
|
When sending "GET" to "/cloud/users"
|
||||||
And users returned are
|
And users returned are
|
||||||
| brand-new-user | admin |
|
| brand-new-user |
|
||||||
|
| admin |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Edit a user
|
Scenario: Edit a user
|
||||||
|
@ -81,11 +84,14 @@ Feature: provisioning
|
||||||
And group "new-group" exists
|
And group "new-group" exists
|
||||||
|
|
||||||
|
|
||||||
Scenario: Getting all users
|
Scenario: Getting all groups
|
||||||
Given As an "admin"
|
Given As an "admin"
|
||||||
|
And group "new-group" exists
|
||||||
|
And group "admin" exists
|
||||||
When sending "GET" to "/cloud/groups"
|
When sending "GET" to "/cloud/groups"
|
||||||
And groups returned are
|
And groups returned are
|
||||||
| admin | new-group |
|
| admin |
|
||||||
|
| new-group |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Delete a group
|
Scenario: Delete a group
|
||||||
|
|
Loading…
Reference in New Issue