function FilterAPITest::setUp

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in Drupal\simpletest\WebTestBase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides WebTestBase::setUp

See also

Drupal\simpletest\WebTestBase::prepareDatabasePrefix()

Drupal\simpletest\WebTestBase::changeDatabasePrefix()

Drupal\simpletest\WebTestBase::prepareEnvironment()

File

drupal/core/modules/filter/lib/Drupal/filter/Tests/FilterAPITest.php, line 25
Definition of Drupal\filter\Tests\FilterAPITest.

Class

FilterAPITest
Tests the behavior of Filter's API.

Namespace

Drupal\filter\Tests

Code

function setUp() {
  parent::setUp();

  // Create Filtered HTML format.
  $filtered_html_format = array(
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'filters' => array(
      // Note that the filter_html filter is of the type FILTER_TYPE_MARKUP_LANGUAGE.
      'filter_url' => array(
        'weight' => -1,
        'status' => 1,
      ),
      // Note that the filter_html filter is of the type FILTER_TYPE_HTML_RESTRICTOR.
      'filter_html' => array(
        'status' => 1,
      ),
    ),
  );
  $filtered_html_format = (object) $filtered_html_format;
  filter_format_save($filtered_html_format);

  // Create Full HTML format.
  $full_html_format = array(
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 1,
    'filters' => array(
      'filter_htmlcorrector' => array(
        'weight' => 10,
        'status' => 1,
      ),
    ),
  );
  $full_html_format = (object) $full_html_format;
  filter_format_save($full_html_format);
}