You are here

public function SchedulerFunctionalTest::testExtraFields in Scheduler 7

Tests if options can both be displayed as extra fields and vertical tabs.

File

tests/scheduler.test, line 346
Scheduler module test case file.

Class

SchedulerFunctionalTest
Tests the scheduler interface.

Code

public function testExtraFields() {
  $this
    ->drupalLogin($this->adminUser);

  // Test if the options are shown as vertical tabs by default.
  $this
    ->drupalGet('node/add/page');
  $this
    ->assertTrue($this
    ->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'By default the scheduler options are shown as a vertical tab.');

  // Test if the options are shown as extra fields when configured to do so.
  variable_set('scheduler_use_vertical_tabs_page', 0);
  $this
    ->drupalGet('node/add/page');
  $this
    ->assertFalse($this
    ->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'The scheduler options are not shown as a vertical tab when they are configured to show as an extra field.');
  $this
    ->assertTrue($this
    ->xpath('//fieldset[@id = "edit-scheduler-settings" and contains(@class, "collapsed")]'), 'The scheduler options are shown as a collapsed fieldset when they are configured to show as an extra field.');

  // Test the option to expand the fieldset.
  variable_set('scheduler_expand_fieldset_page', 1);
  $this
    ->drupalGet('node/add/page');
  $this
    ->assertFalse($this
    ->xpath('//div[contains(@class, "vertical-tabs-panes")]/fieldset[@id = "edit-scheduler-settings"]'), 'The scheduler options are not shown as a vertical tab when they are configured to show as an expanded fieldset.');
  $this
    ->assertTrue($this
    ->xpath('//fieldset[@id = "edit-scheduler-settings" and not(contains(@class, "collapsed"))]'), 'The scheduler options are shown as an expanded fieldset.');
}