function StageNotInActiveValidatorTest::testCheckNotInActive

@covers ::validate

@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/StageNotInActiveValidatorTest.php, line 37

Class

StageNotInActiveValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\StageNotInActiveValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

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(StageBase::class)
        ->reveal();
    $stage_not_in_active_validator = new StageNotInActiveValidator($path_locator);
    $stage_not_in_active_validator->setStringTranslation($this->getStringTranslationStub());
    $event = new PreCreateEvent($stage, $this->createMock(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.