You are here

function SemicleanUnitTest::testCleanState in Semiclean 7

Same name and namespace in other branches
  1. 8 semiclean.test \SemicleanUnitTest::testCleanState()
  2. 6 semiclean.test \SemicleanUnitTest::testCleanState()

Test clean state.

File

./semiclean.test, line 24
Unit tests for Semiclean.

Class

SemicleanUnitTest
@file Unit tests for Semiclean.

Code

function testCleanState() {
  $this
    ->drupalGet('admin/reports/status/semiclean');
  $this
    ->assertResponse(403, 'Cannot access Semiclean cleaner as anonymous.');
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertText('Cron is not running', 'Cron is not running.');
  variable_set('cron_semaphore', time());
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertText('Cron started at', 'Cron is running.');
  $this
    ->assertText('If it seems like cron has been running for too long, or is otherwise stuck, you might need to reset the semaphore.', 'Description exists.');
  $this
    ->clickLink('Clean now!');
  $this
    ->assertText('Cron semaphore cleaned.', 'Status message appeared.');
  $this
    ->assertText('Cron is not running', 'Cron is not running.');
}