Docs for BasicStructure

This commit is contained in:
Joas Schilling 2016-03-11 10:37:21 +01:00
parent 6381c22a7d
commit 0f214017d2
1 changed files with 16 additions and 0 deletions

View File

@ -62,6 +62,7 @@ trait BasicStructure {
/**
* @Given /^As an "([^"]*)"$/
* @param string $user
*/
public function asAn($user) {
$this->currentUser = $user;
@ -69,6 +70,7 @@ trait BasicStructure {
/**
* @Given /^Using server "([^"]*)"$/
* @param string $server
*/
public function usingServer($server) {
if ($server === 'LOCAL'){
@ -84,6 +86,8 @@ trait BasicStructure {
/**
* @When /^sending "([^"]*)" to "([^"]*)"$/
* @param string $verb
* @param string $url
*/
public function sendingTo($verb, $url) {
$this->sendingToWith($verb, $url, null);
@ -101,6 +105,8 @@ trait BasicStructure {
/**
* This function is needed to use a vertical fashion in the gherkin tables.
* @param array $arrayOfArrays
* @return array
*/
public function simplifyArray($arrayOfArrays){
$a = array_map(function($subArray) { return $subArray[0]; }, $arrayOfArrays);
@ -109,6 +115,9 @@ trait BasicStructure {
/**
* @When /^sending "([^"]*)" to "([^"]*)" with$/
* @param string $verb
* @param string $url
* @param \Behat\Gherkin\Node\TableNode $body
*/
public function sendingToWith($verb, $url, $body) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url;
@ -139,6 +148,7 @@ trait BasicStructure {
/**
* @Then /^the OCS status code should be "([^"]*)"$/
* @param int $statusCode
*/
public function theOCSStatusCodeShouldBe($statusCode) {
PHPUnit_Framework_Assert::assertEquals($statusCode, $this->getOCSResponse($this->response));
@ -146,6 +156,7 @@ trait BasicStructure {
/**
* @Then /^the HTTP status code should be "([^"]*)"$/
* @param int $statusCode
*/
public function theHTTPStatusCodeShouldBe($statusCode) {
PHPUnit_Framework_Assert::assertEquals($statusCode, $this->response->getStatusCode());
@ -160,6 +171,7 @@ trait BasicStructure {
/**
* @Given Logging in using web as :user
* @param string $user
*/
public function loggingInUsingWebAs($user) {
$loginUrl = substr($this->baseUrl, 0, -5);
@ -192,6 +204,8 @@ trait BasicStructure {
/**
* @When Sending a :method to :url with requesttoken
* @param string $method
* @param string $url
*/
public function sendingAToWithRequesttoken($method, $url) {
$baseUrl = substr($this->baseUrl, 0, -5);
@ -214,6 +228,8 @@ trait BasicStructure {
/**
* @When Sending a :method to :url without requesttoken
* @param string $method
* @param string $url
*/
public function sendingAToWithoutRequesttoken($method, $url) {
$baseUrl = substr($this->baseUrl, 0, -5);