You are here

public static function TestStatus::label in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Test/TestStatus.php \Drupal\Core\Test\TestStatus::label()

Turns a status code into a human-readable string.

Parameters

int $status: A test runner return code.

Return value

string The human-readable version of the status code.

2 calls to TestStatus::label()
PhpUnitTestRunner::runTests in core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
Executes PHPUnit tests and returns the results of the run.
PhpUnitTestRunnerTest::testRunTestsError in core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
Test an error in the test running phase.

File

core/lib/Drupal/Core/Test/TestStatus.php, line 51

Class

TestStatus
Consolidates test result status information.

Namespace

Drupal\Core\Test

Code

public static function label($status) {
  $statusMap = [
    static::PASS => 'pass',
    static::FAIL => 'fail',
    static::EXCEPTION => 'exception',
    static::SYSTEM => 'error',
  ];

  // For status 3 and higher, we want 'error.'
  $label = $statusMap[$status > static::SYSTEM ? static::SYSTEM : $status];
  return $label;
}