function DuplicateInfoFileValidatorTest::testDuplicateInfoFilesInStage
Tests that duplicate info.yml in stage raise an error.
@dataProvider providerDuplicateInfoFilesInStage
Parameters
string[] $active_info_files: An array of info.yml files in active directory.
string[] $stage_info_files: An array of info.yml files in stage directory.
\Drupal\package_manager\ValidationResult[] $expected_results: An array of expected results.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ DuplicateInfoFileValidatorTest.php, line 200
Class
- DuplicateInfoFileValidatorTest
- @covers \Drupal\package_manager\Validator\DuplicateInfoFileValidator @group package_manager @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testDuplicateInfoFilesInStage(array $active_info_files, array $stage_info_files, array $expected_results) : void {
$stage = $this->createStage();
$stage->create();
$stage->require([
'composer/semver:^3',
]);
$active_dir = $this->container
->get(PathLocator::class)
->getProjectRoot();
$stage_dir = $stage->getStageDirectory();
foreach ($active_info_files as $active_info_file) {
$this->createFileAtPath($active_dir, $active_info_file);
}
foreach ($stage_info_files as $stage_info_file) {
$this->createFileAtPath($stage_dir, $stage_info_file);
}
try {
$stage->apply();
$this->assertEmpty($expected_results);
} catch (StageEventException $e) {
$this->assertNotEmpty($expected_results);
$this->assertValidationResultsEqual($expected_results, $e->event
->getResults());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.