function UnknownPathExcluderTest::testExcluderCanBeDisabled

Tests that the excluder can be disabled by a config flag.

File

core/modules/package_manager/tests/src/Kernel/PathExcluder/UnknownPathExcluderTest.php, line 209

Class

UnknownPathExcluderTest
@covers \Drupal\package_manager\PathExcluder\UnknownPathExcluder @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel\PathExcluder

Code

public function testExcluderCanBeDisabled() : void {
    $this->createTestProjectForTemplate(TRUE);
    $project_root = $this->container
        ->get(PathLocator::class)
        ->getProjectRoot();
    mkdir($project_root . '/unknown');
    touch($project_root . '/unknown/file.txt');
    $config = $this->config('package_manager.settings');
    $config->set('include_unknown_files_in_project_root', TRUE)
        ->save();
    $stage = $this->createStage();
    $stage->create();
    $this->assertFileExists($stage->getStageDirectory() . '/unknown/file.txt');
    $stage->destroy();
    $config->set('include_unknown_files_in_project_root', FALSE)
        ->save();
    $this->assertFileExists($project_root . '/unknown/file.txt');
    $stage->create();
    $this->assertFileDoesNotExist($stage->getStageDirectory() . '/unknown/file.txt');
}

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