Docs for BasicStructure

This commit is contained in:
Joas Schilling 2016-03-11 10:37:21 +01:00
parent 6381c22a7d
commit 0f214017d2

View file

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