function SandboxManagerBaseTest::testValidateRequirements

@covers ::validateRequirements

@dataProvider providerValidateRequirements

Parameters

string|null $expected_exception: The exception class that should be thrown, or NULL if there should not be any exception.

string $requirement: The requirement (package name and optional constraint) to validate.

File

core/modules/package_manager/tests/src/Unit/SandboxManagerBaseTest.php, line 28

Class

SandboxManagerBaseTest
@coversDefaultClass \Drupal\package_manager\SandboxManagerBase[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public function testValidateRequirements(?string $expected_exception, string $requirement) : void {
  $reflector = new \ReflectionClass(SandboxManagerBase::class);
  $method = $reflector->getMethod('validateRequirements');
  if ($expected_exception) {
    $this->expectException($expected_exception);
  }
  else {
    $this->assertNull($expected_exception);
  }
  $method->invoke(NULL, [
    $requirement,
  ]);
}

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