You are here

public function SiteStatusMessageSchedulerTestCase::testSiteStatusMessageAdminPage in Site Status Message 7

Tests for the Site Status Message admin page.

File

modules/site_status_message_scheduler/tests/site_status_message_scheduler.test, line 45
Tests for Site Status Message Scheduler module.

Class

SiteStatusMessageSchedulerTestCase
Class SiteStatusMessageSchedulerTestCase.

Code

public function testSiteStatusMessageAdminPage() {
  $this
    ->adminLogin();

  // Check the admin page can be accessed by our new user.
  $this
    ->drupalGet($this->siteStatusMessageAdminPage);
  $this
    ->assertResponse(200, 'Ensure a 200 code is returned.');

  // Check the correct fields are on the page.
  $this
    ->assertFieldById('edit-site-status-message-schedule', '', 'Check the use scheduler field is on the admin page.');
  $this
    ->assertFieldById('edit-site-status-message-use-end-date', '', 'Check the use end date field is on the admin page.');
  $this
    ->assertFieldById('edit-site-status-message-start-date-datepicker-popup-0', '', 'Check the start date field is on the admin page.');
  $this
    ->assertFieldById('edit-site-status-message-start-date-timeEntry-popup-1', '', 'Check the start time field is on the admin page.');
  $this
    ->assertFieldById('edit-site-status-message-end-date-datepicker-popup-0', '', 'Check the end date field is on the admin page.');
  $this
    ->assertFieldById('edit-site-status-message-end-date-timeEntry-popup-1', '', 'Check the end time field is on the admin page.');
  $form_elements = $this
    ->xpath('//input[@id]');
  $this
    ->assertEqual(count($form_elements), 15, 'There are exactly 15 Form Elements on the admin page');

  // Check the page cannot be accessed by anonymous user.
  $this
    ->userLogout();
  $this
    ->drupalGet($this->siteStatusMessageAdminPage);
  $this
    ->assertText(t('Access denied'), 'Check that anonymous user gets an Access Denied message for the admin page.');
  $this
    ->assertResponse(403, 'Ensure a 403 Forbidden error is returned.');
}