You are here

public function CacheFlushUICRUDAccessTest::accessAdmin in CacheFlush 8

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

1 call to CacheFlushUICRUDAccessTest::accessAdmin()
CacheFlushUICRUDAccessTest::testAccess in modules/cacheflush_ui/tests/src/Functional/CacheFlushUICRUDAccessTest.php
Run CRUD access test functions.

File

modules/cacheflush_ui/tests/src/Functional/CacheFlushUICRUDAccessTest.php, line 199

Class

CacheFlushUICRUDAccessTest
Test cacheflush UI access on links and interface.

Namespace

Drupal\cacheflush_ui\Tests

Code

public function accessAdmin() {
  $this
    ->drupalLogin($this->adminUser);

  // 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($this->urls['view'] . '2', 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($this->urls['view'] . '1', 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();
}