function AssertLegacyTrait::assertResponse

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertResponse()

Asserts the page responds with the specified response code.

Parameters

int $code: Response code. For example 200 is a successful page request. For a list of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.

Deprecated

in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->statusCodeEquals() instead.

See also

https://www.drupal.org/node/3129738

1 call to AssertLegacyTrait::assertResponse()
BrowserTestBaseTest::testAssertResponse in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy assertResponse().

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 252

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertResponse($code) {
    @trigger_error('AssertLegacyTrait::assertResponse() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->statusCodeEquals() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
    $this->assertSession()
        ->statusCodeEquals($code);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.