protected function TempStoreDatabaseTest::setUp

Sets up unit test environment.

Unlike Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does not install modules because tests are performed without accessing the database. Any required files must be explicitly included by the child class setUp() method.

Overrides UnitTestBase::setUp

File

drupal/core/modules/user/lib/Drupal/user/Tests/TempStoreDatabaseTest.php, line 58
Definition of Drupal\user\Tests\TempStoreDatabaseTest.

Class

TempStoreDatabaseTest
Tests the TempStore namespace.

Namespace

Drupal\user\Tests

Code

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

  // Install system tables to test the key/value storage without installing a
  // full Drupal environment.
  module_load_install('system');
  $schema = system_schema();
  db_create_table('semaphore', $schema['semaphore']);
  db_create_table('key_value_expire', $schema['key_value_expire']);

  // Create several objects for testing.
  for ($i = 0; $i <= 3; $i++) {
    $this->objects[$i] = $this
      ->randomObject();
  }
}