public function ExternalCommandRequirementTest::testMethodRequiresUnavailable in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/BuildTests/Framework/Tests/ExternalCommandRequirementTest.php \Drupal\BuildTests\Framework\Tests\ExternalCommandRequirementTest::testMethodRequiresUnavailable()
@covers ::checkMethodCommandRequirements
File
- core/
tests/ Drupal/ BuildTests/ Framework/ Tests/ ExternalCommandRequirementTest.php, line 111
Class
- ExternalCommandRequirementTest
- @coversDefaultClass \Drupal\BuildTests\Framework\ExternalCommandRequirementsTrait @group Build
Namespace
Drupal\BuildTests\Framework\TestsCode
public function testMethodRequiresUnavailable() {
$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, 'testRequiresUnavailable'));
$this
->fail('Unavailable external command requirement should throw a skipped test error exception.');
} catch (SkippedTestError $exception) {
$this
->assertEquals('Required external commands: unavailable_command', $exception
->getMessage());
}
}