Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Context/RestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ public function theHeaderShouldBeEqualTo($name, $value)
);
}

/**
* Checks, whether the header name is not equal to given text
*
* @Then the header :name should not be equal to :value
*/
public function theHeaderShouldNotBeEqualTo($name, $value) {
$actual = $this->getSession()->getResponseHeader($name);
if (strtolower($value) == strtolower($actual)) {
throw new ExpectationException(
"The header '$name' is equal to '$actual'",
$this->getSession()->getDriver()
);
}
}

/**
* Checks, whether the header name contains the given text
*
Expand Down
1 change: 1 addition & 0 deletions tests/features/rest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Testing RESTContext
When I send a GET request to "rest/index.php"
And the header "Content-Type" should contain "text"
And the header "Content-Type" should be equal to "text/html; charset=UTF-8"
And the header "Content-Type" should not be equal to "x-test/no-such-type"
And the header "Content-Type" should not contain "text/json"
And the header "xxx" should not exist
And the response should expire in the future
Expand Down