function BrowserTestBaseTest::testGetHttpClient
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClient()
- 8.9.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClient()
- 11.x core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::testGetHttpClient()
@covers ::getHttpClient
File
-
core/
tests/ Drupal/ Tests/ Core/ Test/ BrowserTestBaseTest.php, line 43
Class
- BrowserTestBaseTest
- @coversDefaultClass \Drupal\Tests\BrowserTestBase @group Test
Namespace
Drupal\Tests\Core\TestCode
public function testGetHttpClient() : void {
// Our stand-in for the Guzzle client object.
$expected = new \stdClass();
$browserkit_client = $this->getMockBuilder(DrupalTestBrowser::class)
->onlyMethods([
'getClient',
])
->getMock();
$browserkit_client->expects($this->once())
->method('getClient')
->willReturn($expected);
// Because the driver is a BrowserKitDriver, we'll get back a client.
$driver = new BrowserKitDriver($browserkit_client);
$btb = $this->mockBrowserTestBaseWithDriver($driver);
$reflected_get_http_client = new \ReflectionMethod($btb, 'getHttpClient');
$this->assertSame(get_class($expected), get_class($reflected_get_http_client->invoke($btb)));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.