My module has some special functionality based on the user agent of the request. I want to write tests for this functionality based on D8's BrowserTestBase, but it doesn't seem possible to change the user agent string.
prepareRequest method of
BrowserTestBase sets the user agent to the value of
For a test, I tried changing this value to something else, and it breaks the tests.
Now I realize that there appears to be some functionality built into core based on this value that
drupal_generate_test_ua returns and there's checks all over core to detect if Drupal is running within a test or not.
Is there a workaround or any hope for writing tests with a custom user agent?