function SandboxDirectoryValidatorTest::testCheckNotInActive
Same name and namespace in other branches
- 11.x core/modules/package_manager/tests/src/Unit/SandboxDirectoryValidatorTest.php \Drupal\Tests\package_manager\Unit\SandboxDirectoryValidatorTest::testCheckNotInActive()
Tests check not in active.
@legacy-covers ::validate
Attributes
#[DataProvider('providerTestCheckNotInActive')]
Parameters
\Drupal\package_manager\ValidationResult[] $expected: The expected result.
string $project_root: The project root.
string $staging_root: The staging root.
File
-
core/
modules/ package_manager/ tests/ src/ Unit/ SandboxDirectoryValidatorTest.php, line 43
Class
Namespace
Drupal\Tests\package_manager\UnitCode
public function testCheckNotInActive(array $expected, string $project_root, string $staging_root) : void {
$path_locator_prophecy = $this->prophesize(PathLocator::class);
$path_locator_prophecy->getProjectRoot()
->willReturn(Path::canonicalize($project_root));
$path_locator_prophecy->getStagingRoot()
->willReturn(Path::canonicalize($staging_root));
$path_locator_prophecy->getVendorDirectory()
->willReturn('not used');
$path_locator = $path_locator_prophecy->reveal();
$stage = $this->prophesize(SandboxManagerBase::class)
->reveal();
$stage_not_in_active_validator = new SandboxDirectoryValidator($path_locator);
$stage_not_in_active_validator->setStringTranslation($this->getStringTranslationStub());
$event = new PreCreateEvent($stage, $this->createStub(PathListInterface::class));
$stage_not_in_active_validator->validate($event);
$this->assertValidationResultsEqual($expected, $event->getResults(), $path_locator);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.