You are here

public function CacheFlushTest::testClearPresetMenu in CacheFlush 7.3

Check clear cache.

File

./cacheflush.test, line 71
Contains test suite for cacheflush module.

Class

CacheFlushTest
Defines a test for cacheflush module.

Code

public function testClearPresetMenu() {
  $this
    ->createTestEntitys();
  $enabled = array_values(cacheflush_load_multiple(FALSE, array(
    'title' => 'Enabled',
    'status' => 1,
  )));
  $this
    ->assertEqual($enabled[0]->title, 'Enabled', 'Created and loaded entity: enabled.');
  $disabled = array_values(cacheflush_load_multiple(FALSE, array(
    'title' => 'Disabled',
    'status' => 0,
  )));
  $this
    ->assertEqual($disabled[0]->title, 'Disabled', 'Created and loaded entity: disabled.');
  $this
    ->drupalLogin($this->testUser);

  // Check access of the menus - access TRUE expected.
  $this
    ->drupalGet('admin/cacheflush');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/cacheflush/clearall');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/cacheflush/' . $enabled[0]->id);
  $this
    ->assertResponse(200);

  // Check if the disabled entity will be refused.
  $this
    ->drupalGet('admin/cacheflush/' . $disabled[0]->id);
  $this
    ->assertResponse(403);
  $this
    ->drupalLogout();
}