Checks that current response code equals to provided one.

@param int $code

@throws ExpectationException
768885
public function statusCodeEquals($code)
    {
        $actual = $this->session->getStatusCode();
        $message = sprintf('Current response status code is %d, but %d expected.', $actual, $code);

        $this->assert(intval($code) === intval($actual), $message);
    }
1298233
protected function validateResponseCode($code) {
        $code = (int) $code;

        try {
            Assertion::range($code, 100, 599, sprintf('Response code must be between 100 and 599, got %d.', $code));
        } catch (AssertionFailure $e) {
            throw new InvalidArgumentException($e->getMessage());
        }

        return $code;
    }
1080536
public static function getMessageFromCode($code)
    {
        if (!array_key_exists($code, self::$responseCodes)) {
            throw new \Exception('The header code '.$code.' is not valid.');
        }

        return self::$responseCodes[$code];
    }
616564
public function setHttpResponseCode($code)
        {
            if (!is_int($code) || (100 > $code) || (599 < $code)) {
                throw new Exception('Invalid HTTP response code');
            }

            if ((300 <= $code) && (307 >= $code)) {
                $this->_isRedirect = true;
            } else {
                $this->_isRedirect = false;
            }

            $this->_httpResponseCode = $code;

            return $this;
        }
74230
public static function create($actual, $expected, $code = 0, \Exception $prev = null)
    {
        $message = sprintf(
            'The value must be a type of %s, %s given.',
            is_object($expected) ? get_class($expected) : (is_scalar($expected) ? $expected : gettype($expected)),
            is_object($actual) ? get_class($actual) : (is_scalar($actual) ? $actual : gettype($actual))
        );

        return new static($message, $code, $prev);
    }
730218
public function withStatus($code = 200)
    {
        if (!array_key_exists($code, self::$responseCodes)) {
            throw new \Exception('That header code '.$code.' is not allowed.');
        }

        $this->code = $code;
        $this->reasonPhrase = self::$responseCodes[$code];

        return $this;
    }
924754
public function validateConfirmationCode($code)
    {
        $ccAttribute = $this->confirmCodeAttribute;
        if (!$ccAttribute || empty($ccAttribute)) {
            return true;
        }
        return $this->$ccAttribute === $code;
    }
1249952
public function equalTo($expected): Expect {
            $this->testsTheEqualityAgainstAValue = true;
            $this->expected = $expected;

            return $this;
        }
1022258
private function checkResponseCode($responseCode)
    {
        switch ($responseCode) {
            case self::REQUEST_HAS_SUCCEED_CODE:
                break;

            case self::MALFORMED_NOTIFICATION_CODE:
                throw new MalformedNotificationException(
                    "The request could not be parsed as JSON, or it contained invalid fields",
                    self::MALFORMED_NOTIFICATION_CODE
                );

            case self::AUTHENTICATION_ERROR_CODE:
                throw new DispatchMessageException(
                    "There was an error authenticating the sender account.",
                    self::AUTHENTICATION_ERROR_CODE
                );

            default:
                throw new RuntimeException(
                    "Unknown error occurred while sending notification."
                );
        }
    }
1281056
public function setStatusCode(int $statusCode): void {
		if ($this->compiled) {
			throw new ResponseException("Attempt to alter response after compilation.", ResponseException::AFTER_COMPILE_ALTERATION);
		}
		
		if (!in_array($statusCode, array_keys($this->phrases))) {
			throw new ResponseException("Unknown status code: $statusCode.");
		}
		
		$this->statusCode = $statusCode;
	}
789571
public static function isBodyAllowed($code)
    {
        if (!isset(self::$codesDescriptions[$code])) {
            throw new InvalidArgumentException("Invalid code $code specified");
        }

        return ($code >= self::OK && $code !== self::NO_CONTENT && $code !== self::NOT_MODIFIED);
    }
709669
private function assertValid($object, int $code = 0)
    {
        $errors = $this->validator->validate($object);
        if (count($errors)) {
            throw ValidationException::becauseOfValidationErrors($errors, $code);
        }
    }
1338320
public function setWarehouseCode( $code )
	{
		$this->_checkCode( $code );

		if ( $code == $this->getWarehouseCode() ) { return; }

		$this->_values['warehousecode'] = (string) $code;
		$this->setModified();
	}
779656
public function verifyServiceExpectations($service)
    {
        try {
            $service->mockery_verify();
        } catch (CountValidatorException $exception) {
            throw new ExpectationException('One of the expected services was not called', $this->mink->getSession(), $exception);
        }
    }
754726
public function setHttpCode(int $code): Response
    {
        if ($this->response_finished) {
            return $this;

        }

        $this->response_code = $code;

        return $this;
    }
848015
public function setResponseCode($code)
    {
        if (!ResponseCode::isValid($code)) {
            throw new \InvalidArgumentException('setResponseCode(): Invalid HTTP response code given of value ' . strval($code));
        }

        $this->statusCode = $code;
        return $this;
    }
846532
public function assertResponseStatus($code)
    {
        $actual = $this->response->getStatusCode();

        PHPUnit::assertEquals($code, $this->response->getStatusCode(), "Expected status code {$code}, got {$actual}.");

        return $this;
    }