You are here

public function UiPhpUnitOutputTest::testOutput in SimpleTest 8.3

Tests that PHPUnit output in the Simpletest UI looks good.

File

src/Tests/UiPhpUnitOutputTest.php, line 28

Class

UiPhpUnitOutputTest
Test PHPUnit output for the Simpletest UI.

Namespace

Drupal\simpletest\Tests

Code

public function testOutput() {
  require_once __DIR__ . '/../../tests/fixtures/simpletest_phpunit_browsertest.php';
  $phpunit_junit_file = $this->container
    ->get('file_system')
    ->realpath('public://phpunit_junit.xml');

  // Prepare the default browser test output directory in the child site.
  $this->container
    ->get('file_system')
    ->mkdir('public://simpletest');
  $status = 0;
  $output = [];
  simpletest_phpunit_run_command([
    SimpletestPhpunitBrowserTest::class,
  ], $phpunit_junit_file, $status, $output);

  // Check that there are <br> tags for the HTML output by
  // SimpletestUiPrinter.
  $this
    ->assertEqual($output[20], 'HTML output was generated<br />');

  // Check that URLs are printed as HTML links.
  $this
    ->assertIdentical(strpos($output[21], '<a href="http'), 0);
}