You are here

public function CronKeyChange::testCronKeyChange in Cron key change 7

Tests the change cron key.

File

./cronkeychange.test, line 38
Tests the Cron key change module.

Class

CronKeyChange
Tests the Cron key change module.

Code

public function testCronKeyChange() {
  $original_cron_key = variable_get('cron_key');
  $this
    ->drupalGet('admin/config/system/cron');
  $visible_cron_key = trim($this
    ->getXpathTextValue($this
    ->drupalGetContent(), "id('edit-current')/text()[2]"));
  $this
    ->assertEqual($original_cron_key, $visible_cron_key, 'Original value show correctly.');

  // Generate new key.
  $this
    ->drupalPost('admin/config/system/cron', array(), t('Generate new key'));
  $visible_cron_key = trim($this
    ->getXpathTextValue($this
    ->drupalGetContent(), "id('edit-current')/text()[2]"));
  $this
    ->assertNotIdentical($visible_cron_key, '', 'Generated cron key is not null.');
  $this
    ->assertNotEqual($original_cron_key, $visible_cron_key, 'Cron key is changed.');
}