function TestStatus::label

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Test/TestStatus.php \Drupal\Core\Test\TestStatus::label()
  2. 8.9.x core/lib/Drupal/Core/Test/TestStatus.php \Drupal\Core\Test\TestStatus::label()
  3. 10 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::execute 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
Tests 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.