You are here

protected function EndOfTransactionQueriesTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php \Drupal\KernelTests\Core\Cache\EndOfTransactionQueriesTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Cache/EndOfTransactionQueriesTest.php, line 33

Class

EndOfTransactionQueriesTest
Tests that cache tag invalidation queries are delayed to the end of transactions.

Namespace

Drupal\KernelTests\Core\Cache

Code

protected function setUp() {
  parent::setUp();

  // This can only be checked after installing Drupal as it requires functions
  // from bootstrap.inc.
  if (!class_exists($this
    ->getDatabaseConnectionInfo()['default']['namespace'] . '\\Connection')) {
    $this
      ->markTestSkipped(sprintf('No logging override exists for the %s database driver. Create it, subclass this test class and override ::getDatabaseConnectionInfo().', $this
      ->getDatabaseConnectionInfo()['default']['driver']));
  }
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('user');

  // Ensure the cachetags table already exists.
  Cache::invalidateTags([
    $this
      ->randomString(),
  ]);
}