function WebAssertTest::visit

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Test/WebAssertTest.php \Drupal\Tests\Core\Test\WebAssertTest::visit()

Simulate a page visit and expect a response.

Parameters

string $uri: The URI to visit. This is only required if assertions are made about the URL, otherwise it can be left empty.

string $content: The expected response content.

array $responseHeaders: The expected response headers.

25 calls to WebAssertTest::visit()
WebAssertTest::testAddressEquals in core/tests/Drupal/Tests/Core/Test/WebAssertTest.php
@covers ::addressEquals
WebAssertTest::testAddressNotEqualsException in core/tests/Drupal/Tests/Core/Test/WebAssertTest.php
@covers ::addressNotEquals
WebAssertTest::testElementTextEquals in core/tests/Drupal/Tests/Core/Test/WebAssertTest.php
@covers ::elementTextEquals
WebAssertTest::testEscapingAssertions in core/tests/Drupal/Tests/Core/Test/WebAssertTest.php
Tests assertEscaped() and assertUnescaped().
WebAssertTest::testFieldAssertsForButton in core/tests/Drupal/Tests/Core/Test/WebAssertTest.php
Tests legacy field asserts for button field type.

... See full list

File

core/tests/Drupal/Tests/Core/Test/WebAssertTest.php, line 65

Class

WebAssertTest
Tests WebAssert functionality.

Namespace

Drupal\Tests\Core\Test

Code

protected function visit(string $uri = '', string $content = '', array $responseHeaders = []) : void {
    $this->client
        ->setExpectedResponse(new Response($content, 200, $responseHeaders));
    $this->session
        ->visit($uri);
}

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