You are here

protected function FreelinkingBrowserTestBase::updateFilterSettings in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/FreelinkingBrowserTestBase.php \Drupal\Tests\freelinking\Functional\FreelinkingBrowserTestBase::updateFilterSettings()

Update filter settings.

Parameters

string $name: The filter name to edit. Defaults to 'plain_text'.

array $edit: The Freelinking filter configuration to edit. Defaults to all freelinking plugins enabled.

5 calls to FreelinkingBrowserTestBase::updateFilterSettings()
FreelinkingFilterTest::setUp in tests/src/Functional/FreelinkingFilterTest.php
FreelinkingMultilingualTest::setUp in tests/src/Functional/FreelinkingMultilingualTest.php
FreelinkingPrefixAffixTest::setUp in tests/src/Functional/FreelinkingPrefixAffixTest.php
FreelinkingPrepopulateTest::setUp in modules/freelinking_prepopulate/tests/src/Functional/FreelinkingPrepopulateTest.php
NodeTitleBuiltinFailoverTest::setUp in tests/src/Functional/NodeTitleBuiltinFailoverTest.php

File

tests/src/Functional/FreelinkingBrowserTestBase.php, line 71

Class

FreelinkingBrowserTestBase
Base test class for functional tests.

Namespace

Drupal\Tests\freelinking\Functional

Code

protected function updateFilterSettings($name = 'plain_text', array $edit = NULL) {
  $label = str_replace('_', ' ', ucwords($name));

  // Set default edit options.
  if (!isset($edit)) {
    $edit = [
      'filters[freelinking][status]' => 1,
      'filters[freelinking][weight]' => 0,
      'filters[freelinking][settings][plugins][nodetitle][enabled]' => 1,
      'filters[freelinking][settings][plugins][external][enabled]' => 1,
      'filters[freelinking][settings][plugins][external][settings][scrape]' => 0,
      'filters[freelinking][settings][plugins][file][enabled]' => 1,
      'filters[freelinking][settings][plugins][file][settings][scheme]' => 'public',
      'filters[freelinking][settings][plugins][drupalorg][enabled]' => 1,
      'filters[freelinking][settings][plugins][drupalorg][settings][scrape]' => 0,
      'filters[freelinking][settings][plugins][drupalorg][settings][node]' => 1,
      'filters[freelinking][settings][plugins][drupalorg][settings][project]' => 1,
      'filters[freelinking][settings][plugins][google][enabled]' => 1,
      'filters[freelinking][settings][plugins][nid][enabled]' => 1,
      'filters[freelinking][settings][plugins][path_alias][enabled]' => 1,
      'filters[freelinking][settings][plugins][search][enabled]' => 1,
      'filters[freelinking][settings][plugins][user][enabled]' => 1,
      'filters[freelinking][settings][plugins][wiki][enabled]' => 1,
      'filters[filter_url][weight]' => 1,
      'filters[filter_html][weight]' => 2,
      'filters[filter_autop][weight]' => 3,
      'filters[filter_htmlcorrector][weight]' => 4,
    ];
  }
  $this
    ->drupalGet('admin/config/content/formats/manage/' . $name);
  $this
    ->submitForm($edit, 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains(t('The text format @label has been updated.', [
    '@label' => $label,
  ]));
  $this
    ->drupalGet('admin/config/content/formats/manage/' . $name);
  $this
    ->assertSession()
    ->checkboxChecked('edit-filters-freelinking-status');
}