diff -u b/core/modules/simpletest/src/Form/SimpletestResultsForm.php b/core/modules/simpletest/src/Form/SimpletestResultsForm.php --- b/core/modules/simpletest/src/Form/SimpletestResultsForm.php +++ b/core/modules/simpletest/src/Form/SimpletestResultsForm.php @@ -61,28 +61,28 @@ // Initialize image mapping property. $image_pass = array( '#theme' => 'image', - '#uri' => 'core/misc/icons/73b355/check.png', + '#uri' => 'core/misc/icons/73b355/check.svg', '#width' => 18, '#height' => 18, '#alt' => $this->t('Pass'), ); $image_fail = array( '#theme' => 'image', - '#uri' => 'core/misc/icons/ea2800/error.png', + '#uri' => 'core/misc/icons/ea2800/error.svg', '#width' => 18, '#height' => 18, '#alt' => $this->t('Fail'), ); $image_exception = array( '#theme' => 'image', - '#uri' => 'core/misc/icons/e29700/warning.png', + '#uri' => 'core/misc/icons/e29700/warning.svg', '#width' => 18, '#height' => 18, '#alt' => $this->t('Exception'), ); $image_debug = array( '#theme' => 'image', - '#uri' => 'core/misc/icons/e29700/warning.png', + '#uri' => 'core/misc/icons/e29700/warning.svg', '#width' => 18, '#height' => 18, '#alt' => $this->t('Debug'), diff -u b/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php --- b/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -743,7 +743,7 @@ $message = '
ID #' . $this->verboseId . ' (Previous | Next)
' . $message; $verbose_filename = $this->verboseClassName . '-' . $this->verboseId . '-' . $this->testId . '.html'; - if (file_put_contents($this->verboseDirectory . '/' . $verbose_filename, $message, FILE_APPEND)) { + if (file_put_contents($this->verboseDirectory . '/' . $verbose_filename, $message)) { $url = $this->verboseDirectoryUrl . '/' . $verbose_filename; // Not using l() to avoid invoking the theme system, so that unit tests // can use verbose() as well. diff -u b/core/scripts/run-tests.sh b/core/scripts/run-tests.sh --- b/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -6,9 +6,13 @@ */ use Drupal\Component\Utility\Timer; +use Drupal\Component\Uuid\Php; use Drupal\Core\Database\Database; +use Drupal\Core\Form\FormState; use Drupal\Core\Site\Settings; +use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\Test\TestRunnerKernel; +use Drupal\simpletest\Form\SimpletestResultsForm; use Symfony\Component\HttpFoundation\Request; $autoloader = require_once __DIR__ . '/../vendor/autoload.php'; @@ -1079,24 +1083,37 @@ */ function simpletest_script_open_browser() { - global $args, $test_ids; + global $test_ids; + // Generate html results. + $connection = Database::getConnection('default', 'test-runner'); + $form = new SimpletestResultsForm($connection); + $form_array = $form->buildForm(array(), new FormState(), implode('+', $test_ids)); + unset($form_array['action']); + unset($form_array['#action']); + $html = drupal_render($form_array); + // Unfortunately calling this tries to write config! + //$html = drupal_get_css() . $html; + $html = '' .$html .''; + $uuid = new Php(); + $filename = PublicStream::basePath() . '/simpletest/verbose/results-'. $uuid->generate() .'.html'; + file_put_contents($filename, $html); // See if we can find an OS helper to open URLs in default browser. if (shell_exec('which xdg-open')) { $browser = 'xdg-open'; } - else if (shell_exec('which open')) { + elseif (shell_exec('which open')) { $browser = 'open'; } - else if (substr(PHP_OS, 0, 3) == 'WIN') { + elseif (substr(PHP_OS, 0, 3) == 'WIN') { $browser = 'start'; } else { // Can't find a valid browser. + // @todo Output some help giving the user the filename of the html to open. $browser = FALSE; } if ($browser) { - $url = $args['url'] . '/admin/config/development/testing/results/' . urlencode(implode('+', $test_ids)); - shell_exec($browser . ' ' . escapeshellarg($url)); + shell_exec($browser . ' ' . escapeshellarg($filename)); } }