You are here

ConfigInstallerTarballTest.php in Configuration installer 8

File

tests/src/Functional/ConfigInstallerTarballTest.php
View source
<?php

namespace Drupal\Tests\config_installer\Functional;


/**
 * Tests the config installer profile by uploading a tarball.
 *
 * @group ConfigInstaller
 */
class ConfigInstallerTarballTest extends ConfigInstallerTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setUpSyncForm() {

    // Test some error situations.
    $this
      ->drupalPostForm(NULL, [
      'files[import_tarball]' => '',
    ], 'Save and continue');
    $this
      ->assertText('No file upload provided and the sync directory is empty');
    $this
      ->drupalPostForm(NULL, [
      'files[import_tarball]' => $this
        ->versionTarball('broken.tar.gz'),
    ], 'Save and continue');
    $this
      ->assertText('Could not extract the contents of the tar file.');
    $this
      ->drupalPostForm(NULL, [
      'files[import_tarball]' => $this
        ->versionTarball('empty.tar.gz'),
    ], 'Save and continue');
    $this
      ->assertText('The tar file contoins no files.');
    $this
      ->drupalPostForm(NULL, [
      'files[import_tarball]' => $this
        ->versionTarball('minimal-validation-fail.tar.gz'),
    ], 'Save and continue');
    $this
      ->assertText('The tar file contoins no files.');
    $this
      ->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
    $this
      ->assertText('Configuration foo.bar depends on the foo extension that will not be installed after import.');

    // Upload the tarball.
    $this
      ->drupalPostForm(NULL, [
      'files[import_tarball]' => $this
        ->getTarball(),
    ], 'Save and continue');
  }

}

Classes

Namesort descending Description
ConfigInstallerTarballTest Tests the config installer profile by uploading a tarball.