RunnerVersion.php

Same filename in other branches
  1. 9 core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
  2. 8.9.x core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php
  3. 10 core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php

Namespace

Drupal\TestTools\PhpUnitCompatibility

File

core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php

View source
<?php

declare (strict_types=1);
namespace Drupal\TestTools\PhpUnitCompatibility;

use PHPUnit\Runner\Version;

/**
 * Helper class to determine information about running PHPUnit version.
 *
 * This class contains static methods only and is not meant to be instantiated.
 */
final class RunnerVersion {
    
    /**
     * This class should not be instantiated.
     */
    private function __construct() {
    }
    
    /**
     * Returns the major version of the PHPUnit runner being used.
     *
     * @return int
     *   The major version of the PHPUnit runner being used.
     */
    public static function getMajor() {
        return (int) explode('.', Version::id())[0];
    }

}

Classes

Title Deprecated Summary
RunnerVersion Helper class to determine information about running PHPUnit version.

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