Skip to content
Snippets Groups Projects
Unverified Commit a74c8c2b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2996476 by andrewbelcher, dawehner, jhedstrom: Allow setting the base...

Issue #2996476 by andrewbelcher, dawehner, jhedstrom: Allow setting the base url for browsertest output
parent f68812c3
Branches
Tags
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards
......@@ -21,6 +21,11 @@
<env name="SIMPLETEST_DB" value=""/>
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
<!-- To have browsertest output use an alternative base URL. For example if
SIMPLETEST_BASE_URL is an internal DDEV URL, you can set this to the
external DDev URL so you can follow the links directly.
-->
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
<!-- To disable deprecation testing completely uncomment the next line. -->
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
<!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
......
......@@ -65,6 +65,13 @@ trait BrowserHtmlDebugTrait {
*/
protected $htmlOutputTestId;
/**
* The Base URI to use for links to the output files.
*
* @var string
*/
protected $htmlOutputBaseUrl;
/**
* Formats HTTP headers as string for HTML output logging.
*
......@@ -118,7 +125,7 @@ protected function htmlOutput($message = NULL) {
file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++);
// Do not use file_create_url() as the module_handler service might not be
// available.
$uri = $GLOBALS['base_url'] . '/sites/simpletest/browser_output/' . $html_output_filename;
$uri = $this->htmlOutputBaseUrl . '/sites/simpletest/browser_output/' . $html_output_filename;
file_put_contents($this->htmlOutputFile, $uri . "\n", FILE_APPEND);
}
......@@ -131,6 +138,7 @@ protected function htmlOutput($message = NULL) {
protected function initBrowserOutputFile() {
$browser_output_file = getenv('BROWSERTEST_OUTPUT_FILE');
$this->htmlOutputEnabled = is_file($browser_output_file);
$this->htmlOutputBaseUrl = getenv('BROWSERTEST_OUTPUT_BASE_URL') ?: $GLOBALS['base_url'];
if ($this->htmlOutputEnabled) {
$this->htmlOutputFile = $browser_output_file;
$this->htmlOutputClassName = str_replace("\\", "_", get_called_class());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment