You are here

class MemoryStorageTest in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/service_container/Tests/KeyValue/MemoryStorageTest.php \Drupal\service_container\Tests\KeyValue\MemoryStorageTest

Tests the key-value memory storage.

@group KeyValueStore

Hierarchy

Expanded class hierarchy of MemoryStorageTest

File

lib/Drupal/service_container/Tests/KeyValue/MemoryStorageTest.php, line 17
Contains Drupal\system\Tests\KeyValueStore\MemoryStorageTest.

Namespace

Drupal\service_container\Tests\KeyValue
View source
class MemoryStorageTest extends StorageTestBase {

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'KeyValue MemoryStorage',
      'description' => 'Tests the key-value memory storage.',
      'group' => 'service_container',
    );
  }
  protected function setUp() {
    parent::setUp('service_container_test');
    \ServiceContainer::reset();
    $services = array();
    $services['keyvalue.memory'] = array(
      'class' => 'Drupal\\Core\\KeyValueStore\\KeyValueMemoryFactory',
    );
    $parameters = array();
    $parameters['factory.keyvalue'][KeyValueFactory::DEFAULT_SETTING] = 'keyvalue.memory';
    $definition['services'] = $services;
    $definition['parameters'] = $parameters;
    variable_set('service_container_test_definition', $definition);
    \ServiceContainer::init();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MemoryStorageTest::getInfo public static function
MemoryStorageTest::setUp protected function Overrides StorageTestBase::setUp
ServiceContainerIntegrationTestBase::$container protected property The dependency injection container usable in the test.
StorageTestBase::$collections protected property An array of data collection labels.
StorageTestBase::$factory protected property Whether we are using an expirable key/value store.
StorageTestBase::$objects protected property An array of random stdClass objects.
StorageTestBase::$profile protected property The profile to install as a basis for testing. Overrides ServiceContainerIntegrationTestBase::$profile
StorageTestBase::assertIdenticalObject protected function Checks to see if two objects are identical.
StorageTestBase::cleanUp protected function
StorageTestBase::createStorage protected function Creates storage objects for each collection defined for this class.
StorageTestBase::testKeyValueStore public function 1
StorageTestBase::_testCRUD public function Tests CRUD operations.
StorageTestBase::_testNonExistingKeys public function Tests expected behavior for non-existing keys.
StorageTestBase::_testRename public function Tests the rename operation.
StorageTestBase::_testSetIfNotExists public function Tests the setIfNotExists() method.