You are here

public function WebformExporterExcludedTest::testExcludeExporters in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/Exporter/WebformExporterExcludedTest.php \Drupal\Tests\webform\Functional\Exporter\WebformExporterExcludedTest::testExcludeExporters()

Test excluded exporters.

File

tests/src/Functional/Exporter/WebformExporterExcludedTest.php, line 17

Class

WebformExporterExcludedTest
Tests for the webform exporter excluded.

Namespace

Drupal\Tests\webform\Functional\Exporter

Code

public function testExcludeExporters() {
  $this
    ->drupalLogin($this->rootUser);

  // Check exporter options.
  $this
    ->drupalGet('/admin/structure/webform/manage/contact/results/download');
  $this
    ->assertRaw('<option value="delimited"');
  $this
    ->assertRaw('<option value="table"');
  $this
    ->assertRaw('<option value="json"');
  $this
    ->assertRaw('<option value="yaml"');

  // Exclude the delimited exporter.
  \Drupal::configFactory()
    ->getEditable('webform.settings')
    ->set('export.excluded_exporters', [
    'delimited' => 'delimited',
  ])
    ->save();

  // Check delimited exporter excluded.
  $this
    ->drupalGet('/admin/structure/webform/manage/contact/results/download');
  $this
    ->assertNoRaw('<option value="delimited"');
  $this
    ->assertRaw('<option value="table"');
  $this
    ->assertRaw('<option value="json"');
  $this
    ->assertRaw('<option value="yaml"');
}