You are here

public function CacheFlushTest::createTestEntitys in CacheFlush 8

Create cacheflush test entities.

1 call to CacheFlushTest::createTestEntitys()
CacheFlushTest::clearPresetMenu in tests/src/Functional/CacheFlushTest.php
Check clear cache.

File

tests/src/Functional/CacheFlushTest.php, line 126

Class

CacheFlushTest
Test cacheflush API.

Namespace

Drupal\Tests\cacheflush\Functional

Code

public function createTestEntitys() {
  $data = [];
  foreach (CacheflushApi::create($this->container)
    ->getOptionList() as $key => $value) {
    $data[$key]['functions'] = $value['functions'];
  }
  $data = serialize($data);
  $entity = cacheflush_create([
    'title' => 'Enabled',
    'status' => 1,
    'data' => $data,
  ]);
  $entity
    ->save();
  $entity = cacheflush_create([
    'title' => 'Disabled',
    'status' => 0,
    'data' => $data,
  ]);
  $entity
    ->save();
}