summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap/BasicStructure.php
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration/features/bootstrap/BasicStructure.php')
-rw-r--r--build/integration/features/bootstrap/BasicStructure.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index f6c93aa5174..3f4f70115bf 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -29,6 +29,7 @@
*
*/
+use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
@@ -165,7 +166,7 @@ trait BasicStructure {
* @When /^sending "([^"]*)" to "([^"]*)" with$/
* @param string $verb
* @param string $url
- * @param \Behat\Gherkin\Node\TableNode $body
+ * @param TableNode $body
*/
public function sendingToWith($verb, $url, $body) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php" . $url;
@@ -179,7 +180,7 @@ trait BasicStructure {
$options['headers'] = [
'OCS_APIREQUEST' => 'true'
];
- if ($body instanceof \Behat\Gherkin\Node\TableNode) {
+ if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
$options['form_params'] = $fd;
}
@@ -216,7 +217,7 @@ trait BasicStructure {
} else {
$options['auth'] = [$this->currentUser, $this->regularUser];
}
- if ($body instanceof \Behat\Gherkin\Node\TableNode) {
+ if ($body instanceof TableNode) {
$fd = $body->getRowsHash();
$options['form_params'] = $fd;
}
@@ -504,4 +505,27 @@ trait BasicStructure {
public function cookiesAreReset() {
$this->cookieJar = new CookieJar();
}
+
+ /**
+ * @Then The following headers should be set
+ * @param TableNode $table
+ * @throws \Exception
+ */
+ public function theFollowingHeadersShouldBeSet(TableNode $table) {
+ foreach($table->getTable() as $header) {
+ $headerName = $header[0];
+ $expectedHeaderValue = $header[1];
+ $returnedHeader = $this->response->getHeader($headerName)[0];
+ if($returnedHeader !== $expectedHeaderValue) {
+ throw new \Exception(
+ sprintf(
+ "Expected value '%s' for header '%s', got '%s'",
+ $expectedHeaderValue,
+ $headerName,
+ $returnedHeader
+ )
+ );
+ }
+ }
+ }
}