You are here

public function CacheFlushUICRUDAccessTest::createTestEntitys in CacheFlush 8

Create cacheflush test entities.

1 call to CacheFlushUICRUDAccessTest::createTestEntitys()
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 293

Class

CacheFlushUICRUDAccessTest
Test cacheflush UI access on links and interface.

Namespace

Drupal\cacheflush_ui\Tests

Code

public function createTestEntitys() {
  $options = CacheflushApi::create($this->container)
    ->getOptionList();
  $data = [];
  $data['bootstrap']['functions'] = $options['bootstrap']['functions'];
  $data['config']['functions'] = $options['config']['functions'];
  $data['default']['functions'] = $options['default']['functions'];
  $data = serialize($data);
  $entity = cacheflush_create([
    'title' => 'LoggedUserEntity',
    'status' => 1,
    'menu' => 1,
    'data' => $data,
    'uid' => $this->loggedUser
      ->id(),
  ]);
  $entity
    ->save();
  $entity = cacheflush_create([
    'title' => 'AdminUserEntity',
    'status' => 1,
    'menu' => 1,
    'data' => $data,
    'uid' => $this->adminUser
      ->id(),
  ]);
  $entity
    ->save();
  $entity = cacheflush_create([
    'title' => 'InterfaceUserEntity',
    'status' => 1,
    'menu' => 1,
    'data' => $data,
    'uid' => $this->interfaceUser
      ->id(),
  ]);
  $entity
    ->save();
  $entity = cacheflush_create([
    'title' => 'InterfaceUser2Entity',
    'status' => 1,
    'menu' => 1,
    'data' => $data,
    'uid' => $this->interfaceUser2
      ->id(),
  ]);
  $entity
    ->save();
  $this->routerBuilder
    ->rebuild();
}