comparison core/tests/Drupal/Tests/BrowserHtmlDebugTrait.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
134 if ($this->htmlOutputEnabled) { 134 if ($this->htmlOutputEnabled) {
135 $this->htmlOutputFile = $browser_output_file; 135 $this->htmlOutputFile = $browser_output_file;
136 $this->htmlOutputClassName = str_replace("\\", "_", get_called_class()); 136 $this->htmlOutputClassName = str_replace("\\", "_", get_called_class());
137 $this->htmlOutputDirectory = DRUPAL_ROOT . '/sites/simpletest/browser_output'; 137 $this->htmlOutputDirectory = DRUPAL_ROOT . '/sites/simpletest/browser_output';
138 // Do not use the file_system service so this method can be called before 138 // Do not use the file_system service so this method can be called before
139 // it is available. 139 // it is available. Checks !is_dir() twice around mkdir() because a
140 if (!is_dir($this->htmlOutputDirectory)) { 140 // concurrent test might have made the directory and caused mkdir() to
141 mkdir($this->htmlOutputDirectory, 0775, TRUE); 141 // fail. In this case we can still use the directory even though we failed
142 // to make it.
143 if (!is_dir($this->htmlOutputDirectory) && !mkdir($this->htmlOutputDirectory, 0775, TRUE) && !is_dir($this->htmlOutputDirectory)) {
144 throw new \RuntimeException(sprintf('Unable to create directory: %s', $this->htmlOutputDirectory));
142 } 145 }
143 if (!file_exists($this->htmlOutputDirectory . '/.htaccess')) { 146 if (!file_exists($this->htmlOutputDirectory . '/.htaccess')) {
144 file_put_contents($this->htmlOutputDirectory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n"); 147 file_put_contents($this->htmlOutputDirectory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n");
145 } 148 }
146 $this->htmlOutputCounterStorage = $this->htmlOutputDirectory . '/' . $this->htmlOutputClassName . '.counter'; 149 $this->htmlOutputCounterStorage = $this->htmlOutputDirectory . '/' . $this->htmlOutputClassName . '.counter';