function MultisiteValidatorTest::testMultisiteDuringPreApply

Tests that an error is flagged if run in a multisite during pre-apply.

@dataProvider providerMultisite

Parameters

string|null $sites_php: The sites.php contents to write, if any. If NULL, no sites.php will be created.

\Drupal\package_manager\ValidationResult[] $expected_results: The expected validation results.

File

core/modules/package_manager/tests/src/Kernel/MultisiteValidatorTest.php, line 97

Class

MultisiteValidatorTest
@covers \Drupal\package_manager\Validator\MultisiteValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testMultisiteDuringPreApply(?string $sites_php, array $expected_results = []) : void {
    $this->addEventTestListener(function () use ($sites_php) : void {
        if ($sites_php) {
            $project_root = $this->container
                ->get(PathLocator::class)
                ->getProjectRoot();
            file_put_contents($project_root . '/sites/sites.php', $sites_php);
        }
    });
    $this->assertResults($expected_results, PreApplyEvent::class);
}

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