You are here

public function TwitterInputFilterTest::testInputFilters in Twitter 6.5

Same name and namespace in other branches
  1. 6.3 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()
  2. 6.4 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()
  3. 7.6 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()
  4. 7.3 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()
  5. 7.4 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()
  6. 7.5 tests/input_filters.test \TwitterInputFilterTest::testInputFilters()

Tests input filters

File

tests/input_filters.test, line 45
Functional tests for the input filters of the twitter module.

Class

TwitterInputFilterTest
@file Functional tests for the input filters of the twitter module.

Code

public function testInputFilters() {

  // Create user
  $this->privileged_user = $this
    ->drupalCreateUser(array(
    'administer nodes',
    'administer filters',
  ));
  $this
    ->drupalLogin($this->privileged_user);

  // Activate twitter input filters
  $edit = array(
    'filters[twitter/0]' => 1,
    'filters[twitter/1]' => 1,
  );
  $this
    ->drupalPost('admin/settings/filters/1', $edit, t('Save configuration'));
  $this
    ->assertText(t('The input format settings have been updated.'));
  $this
    ->drupalGet('admin/settings/filters/1');
  $this
    ->assertFieldChecked('edit-filters-twitter/0', t('Twitter username input filter has been activated'));
  $this
    ->assertFieldChecked('edit-filters-twitter/1', t('Twitter hashtag input filter has been activated'));

  // Create a page so we can evaluate the filters
  $search = '#drupal';
  $username = '@drupal';
  $edit = array();
  $edit['title'] = t('Test page');
  $edit['body'] = t('This is a search over #drupal tag. There is also a link ' . ' to a Twitter account here: @drupal.');
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));
  $this
    ->assertText(t('Page @title has been created.', array(
    '@title' => $edit['title'],
  )));
  $this
    ->assertLink($search, 0, t('Twitter search input filter was created successfully.'));
  $this
    ->assertLink($username, 0, t('Twitter username input filter was created successfully.'));
}