function MultisiteValidatorTest::testMultisite

Tests that Package Manager flags an error if run in a multisite.

@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 77

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

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

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