You are here

protected function ConfigInstallerTarballTest::setUpSyncForm in Configuration installer 8

Submit the config_installer_sync_configure_form.

Overrides ConfigInstallerTestBase::setUpSyncForm

See also

\Drupal\config_installer\Form\SyncConfigureForm

File

tests/src/Functional/ConfigInstallerTarballTest.php, line 15

Class

ConfigInstallerTarballTest
Tests the config installer profile by uploading a tarball.

Namespace

Drupal\Tests\config_installer\Functional

Code

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');
}