You are here

function ConfigStorageTestBase::testDataTypes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config/src/Tests/Storage/ConfigStorageTestBase.php \Drupal\config\Tests\Storage\ConfigStorageTestBase::testDataTypes()

Tests storage writing and reading data preserving data type.

File

core/modules/config/src/Tests/Storage/ConfigStorageTestBase.php, line 168
Contains \Drupal\config\Tests\Storage\ConfigStorageTestBase.

Class

ConfigStorageTestBase
Base class for testing storage operations.

Namespace

Drupal\config\Tests\Storage

Code

function testDataTypes() {
  $name = 'config_test.types';
  $data = array(
    'array' => array(),
    'boolean' => TRUE,
    'exp' => 1.2E+34,
    'float' => 3.14159,
    'hex' => 0xc,
    'int' => 99,
    'octal' => 0775,
    'string' => 'string',
    'string_int' => '1',
  );
  $result = $this->storage
    ->write($name, $data);
  $this
    ->assertIdentical($result, TRUE);
  $read_data = $this->storage
    ->read($name);
  $this
    ->assertIdentical($read_data, $data);
}