You are here

public function testAfFormsTestCase::testAfSaveConfig in Advanced Forum 7.2

Implements admin form save.

File

tests/af.test, line 66
Unit tests for advanced_forum.module.

Class

testAfFormsTestCase
Class testAfFormsTestCase

Code

public function testAfSaveConfig() {
  $this->privileged_user = $this
    ->drupalCreateUser(array(
    'administer advanced forum',
    'view forum statistics',
    'view last edited notice',
  ));
  $this
    ->drupalLogin($this->privileged_user);
  $edit = array();

  // Let's test all admin forms.
  $this
    ->drupalPost('admin/config/content/advanced-forum', $edit, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved.'));
  $this
    ->drupalGet('forum', $edit);
  $this
    ->drupalGet('forum/active', $edit);
  $this
    ->drupalGet('forum/unanswered', $edit);
  $this
    ->drupalPost('forum/new', $edit, t('Apply'));
  $this
    ->drupalPost('forum/unanswered', $edit, t('Apply'));
  $this
    ->drupalPost('forum/active', $edit, t('Apply'));
  $edit1 = array(
    'forum' => 1,
  );
  $this
    ->drupalPost('forum/new', $edit1, t('Apply'));
  $this
    ->drupalPost('forum/unanswered', $edit1, t('Apply'));
  $this
    ->drupalPost('forum/active', $edit1, t('Apply'));
  $this
    ->drupalGet('forum/markasread', $edit);
  $edit2 = array(
    'forum' => 'All',
  );
  $this
    ->drupalPost('forum/new', $edit2, t('Apply'));
  $this
    ->drupalPost('forum/unanswered', $edit2, t('Apply'));
  $this
    ->drupalPost('forum/active', $edit2, t('Apply'));

  // Test the form to create forum with option to add fields from taxonomy term.
  $edit3 = array(
    'advanced_forum_forum_user_term_fields' => TRUE,
  );
  $this
    ->drupalPost('admin/config/content/advanced-forum', $edit3, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved.'));
  $this
    ->drupalGet('node/add/forum', array());
}