Commit 03b22009 authored by catch's avatar catch
Browse files

Issue #2958228 by tstoeckler, alexpott: HTML output recording does not work...

Issue #2958228 by tstoeckler, alexpott: HTML output recording does not work for InstallerTestBase tests
parent 013d70a2
...@@ -140,6 +140,9 @@ protected function setUp() { ...@@ -140,6 +140,9 @@ protected function setUp() {
// Setup Mink. // Setup Mink.
$this->initMink(); $this->initMink();
// Set up the browser test output file.
$this->initBrowserOutputFile();
$this->visitInstaller(); $this->visitInstaller();
// Select language. // Select language.
......
...@@ -393,7 +393,12 @@ protected function initBrowserOutputFile() { ...@@ -393,7 +393,12 @@ protected function initBrowserOutputFile() {
$this->htmlOutputFile = $browser_output_file; $this->htmlOutputFile = $browser_output_file;
$this->htmlOutputClassName = str_replace("\\", "_", get_called_class()); $this->htmlOutputClassName = str_replace("\\", "_", get_called_class());
$this->htmlOutputDirectory = DRUPAL_ROOT . '/sites/simpletest/browser_output'; $this->htmlOutputDirectory = DRUPAL_ROOT . '/sites/simpletest/browser_output';
if (file_prepare_directory($this->htmlOutputDirectory, FILE_CREATE_DIRECTORY) && !file_exists($this->htmlOutputDirectory . '/.htaccess')) { // Do not use the file_system service so this method can be called before
// it is available.
if (!is_dir($this->htmlOutputDirectory)) {
mkdir($this->htmlOutputDirectory, 0775, TRUE);
}
if (!file_exists($this->htmlOutputDirectory . '/.htaccess')) {
file_put_contents($this->htmlOutputDirectory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n"); file_put_contents($this->htmlOutputDirectory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n");
} }
$this->htmlOutputCounterStorage = $this->htmlOutputDirectory . '/' . $this->htmlOutputClassName . '.counter'; $this->htmlOutputCounterStorage = $this->htmlOutputDirectory . '/' . $this->htmlOutputClassName . '.counter';
...@@ -1144,7 +1149,10 @@ protected function htmlOutput($message) { ...@@ -1144,7 +1149,10 @@ protected function htmlOutput($message) {
$html_output_filename = $this->htmlOutputClassName . '-' . $this->htmlOutputCounter . '-' . $this->htmlOutputTestId . '.html'; $html_output_filename = $this->htmlOutputClassName . '-' . $this->htmlOutputCounter . '-' . $this->htmlOutputTestId . '.html';
file_put_contents($this->htmlOutputDirectory . '/' . $html_output_filename, $message); file_put_contents($this->htmlOutputDirectory . '/' . $html_output_filename, $message);
file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++); file_put_contents($this->htmlOutputCounterStorage, $this->htmlOutputCounter++);
file_put_contents($this->htmlOutputFile, file_create_url('sites/simpletest/browser_output/' . $html_output_filename) . "\n", FILE_APPEND); // 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;
file_put_contents($this->htmlOutputFile, $uri . "\n", FILE_APPEND);
} }
/** /**
......
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