function DatabaseStorageTest::setUp

Same name in this branch
  1. 8.x drupal/core/modules/config/lib/Drupal/config/Tests/Storage/DatabaseStorageTest.php \Drupal\config\Tests\Storage\DatabaseStorageTest::setUp()
  2. 8.x drupal/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageTest.php \Drupal\system\Tests\KeyValueStore\DatabaseStorageTest::setUp()

Sets up Drupal unit test environment.

Overrides DrupalUnitTestBase::setUp

See also

DrupalUnitTestBase::$modules

DrupalUnitTestBase

File

drupal/core/modules/config/lib/Drupal/config/Tests/Storage/DatabaseStorageTest.php, line 24
Definition of Drupal\config\Tests\Storage\DatabaseStorageTest.

Class

DatabaseStorageTest
Tests DatabaseStorage controller operations.

Namespace

Drupal\config\Tests\Storage

Code

function setUp() {
  parent::setUp();
  $schema['config'] = array(
    'description' => 'Database storage for the configuration system.',
    'fields' => array(
      'name' => array(
        'description' => 'The identifier for the configuration entry, such as module.example (the name of the file, minus the file extension).',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'The raw data for this configuration entry.',
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'translatable' => TRUE,
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  db_create_table('config', $schema['config']);
  $this->storage = new DatabaseStorage($this->container
    ->get('database'), 'config');
  $this->invalidStorage = new DatabaseStorage($this->container
    ->get('database'), 'invalid');

  // ::listAll() verifications require other configuration data to exist.
  $this->storage
    ->write('system.performance', array());
}