function SandboxManagerBaseTest::testValidateRequirements

Tests validate requirements.

@legacy-covers ::validateRequirements

Attributes

#[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 33

Class

SandboxManagerBaseTest
Tests Drupal\package_manager\SandboxManagerBase.

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.