Problem/Motivation
If using a different driver instance and not DrupalTestBrowser \Drupal\Tests\BrowserTestBase::initMink crashes as it assumes the abstract browser instance has a method for setting the HTTP client.
$driver->getClient()->setClient($client); this fails.
Steps to reproduce
I was experimenting with \Symfony\Component\HttpKernel\HttpKernelBrowser.
protected function getDefaultDriverInstance() {
return new BrowserKitDriver(new HttpKernelBrowser(
$this->container->get('http_kernel')
));
}
but initMink crashes with this.
Proposed resolution
Verify the driver's client is instance of DrupalTestBrowser
$driver->getClient() instanceof DrupalTestBrowser
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3553671
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3553671-browsertestbaseinitmink-crashes-if
changes, plain diff MR !13553
Comments
Comment #3
mglamanComment #4
larowlanLooks good to me
Comment #5
mglamanThanks @larowlan!
Comment #6
longwaveUiHelperTrait::isTestUsingGuzzleClient() does the same check, but needs the session to be initialised first - this is the code that does that initialisation, so we can't easily reuse it. Given this is a one line change this seems fine.
Backported down to 10.5.x as an eligible bug fix.