You are here

public function CacheFlushUICRUDAccessTest::testAccessAdmin in CacheFlush 7.3

Test the access for user with permissions to all content (full CRUD).

File

modules/cacheflush_ui/cacheflush_ui.test, line 377
Contains test suite for cacheflush ui module.

Class

CacheFlushUICRUDAccessTest
Defines a test for cacheflush ui module CRUD access.

Code

public function testAccessAdmin() {
  $this
    ->drupalLogin($this->admin_user);

  // Access to administration page.
  $this
    ->cacheflushUrlAccess($this->urls['admin'], 200);

  // Access to new entity create.
  $this
    ->cacheflushUrlAccess($this->urls['new'], 200);

  // Access to cache clear.
  $this
    ->cacheflushUrlAccess($this->urls['clear'] . '1', 200);
  $this
    ->cacheflushUrlAccess($this->urls['clear'] . '2', 200);

  // Access to CRUD for own entity.
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 2, $this->urls['view']), 200);
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 2, $this->urls['edit']), 200);
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 2, $this->urls['delete']), 200);

  // Access to CRUD for other user created entity.
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 1, $this->urls['view']), 200);
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 1, $this->urls['edit']), 200);
  $this
    ->cacheflushUrlAccess(str_replace("[ID]", 1, $this->urls['delete']), 200);

  // Check Access on the list interface.
  $this
    ->drupalGet('admin/structure/cacheflush');
  $this
    ->assertRaw('LoggedUserEntity');
  $this
    ->assertRaw('AdminUserEntity');
  $this
    ->assertRaw('InterfaceUserEntity');
  $this
    ->assertRaw('InterfaceUser2Entity');

  // User has access on the 4 entities to all operations.
  $this
    ->assertLink('Edit', 3);
  $this
    ->assertLink('Delete', 3);
  $this
    ->drupalLogout();
}