function ExternalCommandRequirementTest::testCheckExternalCommandRequirementsNotAvailable

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

@covers ::checkExternalCommandRequirements

File

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

Class

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

Namespace

Drupal\BuildTests\Framework\Tests

Code

public function testCheckExternalCommandRequirementsNotAvailable() {
    $requires = new UsesCommandRequirements();
    $ref_check_requirements = new \ReflectionMethod($requires, 'checkExternalCommandRequirements');
    $ref_check_requirements->setAccessible(TRUE);
    // Use a try/catch block because otherwise PHPUnit might think this test is
    // legitimately skipped.
    try {
        $ref_check_requirements->invokeArgs($requires, [
            [
                'externalCommand not_available',
                'externalCommand available_command',
            ],
        ]);
        $this->fail('Unavailable external command requirement should throw a skipped test error exception.');
    } catch (SkippedTestError $exception) {
        $this->assertEquals('Required external commands: not_available', $exception->getMessage());
    }
}

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