function ConfigImportUploadTest::testImportTarballFiltering

Same name and namespace in other branches
  1. main core/modules/config/tests/src/Functional/ConfigImportUploadTest.php \Drupal\Tests\config\Functional\ConfigImportUploadTest::testImportTarballFiltering()

Tests importing tarball with non-config contents.

File

core/modules/config/tests/src/Functional/ConfigImportUploadTest.php, line 78

Class

ConfigImportUploadTest
Tests importing configuration from an uploaded file.

Namespace

Drupal\Tests\config\Functional

Code

public function testImportTarballFiltering() : void {
  $this->drupalGet('admin/config/development/configuration/full/import');
  $this->assertSession()
    ->statusCodeEquals(200);
  $tarball = __DIR__ . '/../../fixtures/not_just_config.tar.gz';
  $edit = [
    'files[import_tarball]' => $tarball,
  ];
  $this->drupalGet('admin/config/development/configuration/full/import');
  $this->submitForm($edit, 'Upload');
  $sync_directory = Settings::get('config_sync_directory');
  $this->assertFileExists($sync_directory . DIRECTORY_SEPARATOR . 'config.one.yml');
  $this->assertFileExists($sync_directory . DIRECTORY_SEPARATOR . 'config.two.yml');
  $this->assertFileExists($sync_directory . DIRECTORY_SEPARATOR . 'executable.yml');
  $this->assertFalse(is_executable($sync_directory . DIRECTORY_SEPARATOR . 'executable.yml'));
  $this->assertFileDoesNotExist($sync_directory . DIRECTORY_SEPARATOR . 'script.sh');
  $this->assertFalse(is_executable($sync_directory . DIRECTORY_SEPARATOR . 'script.sh'));
}

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