Unverified Commit d338a3d4 authored by alexpott's avatar alexpott
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

(cherry picked from commit a74c8c2b)
parent d68d8dfa
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment