function ExternalCommandRequirementTest::testMethodRequiresAvailable

Same name in other branches
  1. 8.9.x core/tests/Drupal/BuildTests/Framework/Tests/ExternalCommandRequirementTest.php \Drupal\BuildTests\Framework\Tests\ExternalCommandRequirementTest::testMethodRequiresAvailable()
  2. 10 core/tests/Drupal/BuildTests/Framework/Tests/ExternalCommandRequirementTest.php \Drupal\BuildTests\Framework\Tests\ExternalCommandRequirementTest::testMethodRequiresAvailable()

@covers ::checkMethodCommandRequirements

File

core/tests/Drupal/BuildTests/Framework/Tests/ExternalCommandRequirementTest.php, line 94

Class

ExternalCommandRequirementTest
@coversDefaultClass \Drupal\BuildTests\Framework\ExternalCommandRequirementsTrait @group Build

Namespace

Drupal\BuildTests\Framework\Tests

Code

public function testMethodRequiresAvailable() {
    $requires = new MethodRequires();
    $ref_check = new \ReflectionMethod($requires, 'checkMethodCommandRequirements');
    $ref_check->setAccessible(TRUE);
    // Use a try/catch block because otherwise PHPUnit might think this test is
    // legitimately skipped.
    try {
        $this->assertNull($ref_check->invoke($requires, 'testRequiresAvailable'));
    } catch (SkippedTestError $exception) {
        $this->fail(sprintf('The external command should be available: %s', $exception->getMessage()));
    }
}

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