You are here

function ConfigImportUploadTest::testImport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Tests/ConfigImportUploadTest.php \Drupal\config\Tests\ConfigImportUploadTest::testImport()

Tests importing configuration.

File

core/modules/config/src/Tests/ConfigImportUploadTest.php, line 43
Contains \Drupal\config\Tests\ConfigImportUploadTest.

Class

ConfigImportUploadTest
Tests importing configuration from an uploaded file.

Namespace

Drupal\config\Tests

Code

function testImport() {

  // Verify access to the config upload form.
  $this
    ->drupalGet('admin/config/development/configuration/full/import');
  $this
    ->assertResponse(200);

  // Attempt to upload a non-tar file.
  $text_file = current($this
    ->drupalGetTestFiles('text'));
  $edit = array(
    'files[import_tarball]' => drupal_realpath($text_file->uri),
  );
  $this
    ->drupalPostForm('admin/config/development/configuration/full/import', $edit, t('Upload'));
  $this
    ->assertText(t('Could not extract the contents of the tar file'));
}