function BrowserTestBaseTest::testGetHttpClientException

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClientException()
  2. 8.9.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClientException()
  3. 11.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClientException()

@covers ::getHttpClient

File

core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php, line 66

Class

BrowserTestBaseTest
@coversDefaultClass \Drupal\Tests\BrowserTestBase @group Test

Namespace

Drupal\Tests\Core\Test

Code

public function testGetHttpClientException() : void {
    // A driver type that isn't BrowserKitDriver. This should cause a
    // RuntimeException.
    $btb = $this->mockBrowserTestBaseWithDriver(new \stdClass());
    $reflected_get_http_client = new \ReflectionMethod($btb, 'getHttpClient');
    $this->expectException(\RuntimeException::class);
    $this->expectExceptionMessage('The Mink client type stdClass does not support getHttpClient().');
    $reflected_get_http_client->invoke($btb);
}

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