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
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
<env name="SIMPLETEST_DB" value=""/> <env name="SIMPLETEST_DB" value=""/>
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output --> <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/> <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. --> <!-- To disable deprecation testing completely uncomment the next line. -->
<!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> --> <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
<!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' --> <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
......
...@@ -65,6 +65,13 @@ trait BrowserHtmlDebugTrait { ...@@ -65,6 +65,13 @@ trait BrowserHtmlDebugTrait {
*/ */
protected $htmlOutputTestId; 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. * Formats HTTP headers as string for HTML output logging.
* *
...@@ -118,7 +125,7 @@ protected function htmlOutput($message = NULL) { ...@@ -118,7 +125,7 @@ protected function htmlOutput($message = NULL) {
file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++); file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++);
// Do not use file_create_url() as the module_handler service might not be // Do not use file_create_url() as the module_handler service might not be
// available. // 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); file_put_contents($this->htmlOutputFile, $uri . "\n", FILE_APPEND);
} }
...@@ -131,6 +138,7 @@ protected function htmlOutput($message = NULL) { ...@@ -131,6 +138,7 @@ protected function htmlOutput($message = NULL) {
protected function initBrowserOutputFile() { protected function initBrowserOutputFile() {
$browser_output_file = getenv('BROWSERTEST_OUTPUT_FILE'); $browser_output_file = getenv('BROWSERTEST_OUTPUT_FILE');
$this->htmlOutputEnabled = is_file($browser_output_file); $this->htmlOutputEnabled = is_file($browser_output_file);
$this->htmlOutputBaseUrl = getenv('BROWSERTEST_OUTPUT_BASE_URL') ?: $GLOBALS['base_url'];
if ($this->htmlOutputEnabled) { if ($this->htmlOutputEnabled) {
$this->htmlOutputFile = $browser_output_file; $this->htmlOutputFile = $browser_output_file;
$this->htmlOutputClassName = str_replace("\\", "_", get_called_class()); $this->htmlOutputClassName = str_replace("\\", "_", get_called_class());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment