RestContext::theResponseShouldNotHaveAField PHP Méthode

theResponseShouldNotHaveAField() public méthode

public theResponseShouldNotHaveAField ( string $name ) : void
$name string
Résultat void
    public function theResponseShouldNotHaveAField($name)
    {
        if ($this->responseIsJson) {
            if ($this->associative) {
                if (is_array($this->responseData) && array_key_exists($name, $this->responseData)) {
                    throw new \Exception('Field "' . $name . '" should not be there!');
                }
            } else {
                if ($this->responseData instanceof stdClass && property_exists($this->responseData, $name)) {
                    throw new \Exception('Field "' . $name . '" should not be there!');
                }
            }
        } else {
            return new Step\Then('the response is JSON');
        }
    }