Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / simpletest / src / Tests / UiPhpUnitOutputTest.php
1 <?php
2
3 namespace Drupal\simpletest\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\Tests\simpletest\Functional\SimpletestPhpunitBrowserTest;
7
8 /**
9  * Test PHPUnit output for the Simpletest UI.
10  *
11  * @group simpletest
12  *
13  * @see \Drupal\Tests\Listeners\SimpletestUiPrinter
14  */
15 class UiPhpUnitOutputTest extends WebTestBase {
16
17   /**
18    * Modules to enable.
19    *
20    * @var string[]
21    */
22   public static $modules = ['simpletest'];
23
24   /**
25    * Tests that PHPUnit output in the Simpletest UI looks good.
26    */
27   public function testOutput() {
28     require_once __DIR__ . '/../../tests/fixtures/simpletest_phpunit_browsertest.php';
29     $phpunit_junit_file = $this->container->get('file_system')->realpath('public://phpunit_junit.xml');
30     // Prepare the default browser test output directory in the child site.
31     $this->container->get('file_system')->mkdir('public://simpletest');
32     $status = 0;
33     $output = [];
34     simpletest_phpunit_run_command([SimpletestPhpunitBrowserTest::class], $phpunit_junit_file, $status, $output);
35
36     // Check that there are <br> tags for the HTML output by
37     // SimpletestUiPrinter.
38     $this->assertEqual($output[19], 'HTML output was generated<br />');
39     // Check that URLs are printed as HTML links.
40     $this->assertIdentical(strpos($output[20], '<a href="http'), 0);
41   }
42
43 }