You are here

function FusionApplyUIRulesTestCase::testRules in Fusion Accelerator 7

Same name and namespace in other branches
  1. 7.2 fusion_apply/tests/fusion_apply_ui.test \FusionApplyUIRulesTestCase::testRules()

Tests administrative interface for rules.

File

fusion_apply/tests/fusion_apply_ui.test, line 324
Tests for the Fusion Apply UI module.

Class

FusionApplyUIRulesTestCase
Tests rules administrative pages functionality.

Code

function testRules() {

  // Test that there is a rules page.
  $this
    ->drupalGet('admin/appearance/fusion');
  $this
    ->assertLinkByHref('admin/appearance/fusion/rules');

  // Test that there is a way to add rules.
  $this
    ->drupalGet('admin/appearance/fusion/rules');
  $this
    ->clickLink(t('Create a new rule'), 0);

  // Verify that we end up on the expected URL.
  $this
    ->assertUrl('admin/appearance/fusion/rules/add');

  // Verify that we can create the rule.
  $edit = array(
    'rule[title]' => 'Rule 1',
    'rule[rule_type]' => 'page',
  );
  $this
    ->drupalPost(NULL, $edit, t('Add'));

  // After posting, we expect to be redirected to the rule edit page.
  $this
    ->assertUrl('admin/appearance/fusion/rules/edit/1');

  // Save rule.
  // @todo Add a skin and test whether it applies properly or not.
  $edit = array();
  $this
    ->drupalPost(NULL, $edit, t('Save rule'));

  // We should be returned back to the rules page.
  $this
    ->assertUrl('admin/appearance/fusion/rules');

  // Make sure the new rule appears listed on this page.
  $this
    ->assertLinkByHref('admin/appearance/fusion/rules/edit/1');
}