You are here

protected function BrowserTestBaseTest::mockBrowserTestBaseWithDriver in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::mockBrowserTestBaseWithDriver()
  2. 9 core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php \Drupal\Tests\Core\Test\BrowserTestBaseTest::mockBrowserTestBaseWithDriver()
2 calls to BrowserTestBaseTest::mockBrowserTestBaseWithDriver()
BrowserTestBaseTest::testGetHttpClient in core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php
@covers ::getHttpClient
BrowserTestBaseTest::testGetHttpClientException in core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php
@covers ::getHttpClient

File

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

Class

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

Namespace

Drupal\Tests\Core\Test

Code

protected function mockBrowserTestBaseWithDriver($driver) {
  $session = $this
    ->getMockBuilder(Session::class)
    ->disableOriginalConstructor()
    ->onlyMethods([
    'getDriver',
  ])
    ->getMock();
  $session
    ->expects($this
    ->any())
    ->method('getDriver')
    ->willReturn($driver);
  $btb = $this
    ->getMockBuilder(BrowserTestBase::class)
    ->disableOriginalConstructor()
    ->onlyMethods([
    'getSession',
  ])
    ->getMockForAbstractClass();
  $btb
    ->expects($this
    ->any())
    ->method('getSession')
    ->willReturn($session);
  return $btb;
}