UsesCommandRequirements example

/** * @coversDefaultClass \Drupal\BuildTests\Framework\ExternalCommandRequirementsTrait * @group Build */
class ExternalCommandRequirementTest extends TestCase {

  /** * @covers ::checkExternalCommandRequirements */
  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.');
    }
    
Home | Imprint | This part of the site doesn't use cookies.