You are here

public function CleanerTestCacheClearing::testCacheClearing in Cleaner 7

Test clearing caches.

File

tests/cleaner_cache.test, line 37
Test Clearing Caches.

Class

CleanerTestCacheClearing
Class CleanerTestCacheClearing.

Code

public function testCacheClearing() {

  // Prepare a Cleaner settings.
  $this
    ->cleanerSettings(array(
    'cleaner_clear_cache' => 1,
  ));

  // Create cache.
  $dummy_cache_set = $this
    ->cleanerSaveDummyCache('cleaner_test_variable');

  // Run cleaner.
  $this
    ->cleanerExecute();

  // Get cache after clean.
  $dummy_cache_get = $this
    ->cleanerGetDummyCache('cleaner_test_variable');

  // Check if cache has been cleared.
  $this
    ->assertNotEqual($dummy_cache_set, $dummy_cache_get, 'Cache has been cleared.');

  // Get logs.
  $this
    ->cleanerGetLog();

  // Check if cache clearing has been successfully written to the log.
  $this
    ->assertText('Cleared caches by Cleaner.', 'Cleared cache log OK.');
}