protected function StorageTestBase::createStorage in Service Container 7.2
Same name and namespace in other branches
- 7 lib/Drupal/service_container/Tests/KeyValue/StorageTestBase.php \Drupal\service_container\Tests\KeyValue\StorageTestBase::createStorage()
Creates storage objects for each collection defined for this class.
Storing the storage objects in a class member variable causes a fatal exception in DatabaseStorageExpirableTest, because in that situation garbage collection is not triggered until the test class itself is destructed, after tearDown() has deleted the database tables. Instead, create the storage objects locally in each test using this method.
See also
\Drupal\system\Tests\KeyValueStore\DatabaseStorageExpirable
\Drupal\Core\KeyValueStore\DatabaseStorageExpirable::garbageCollection()
7 calls to StorageTestBase::createStorage()
- DatabaseStorageExpirableTest::_testCRUDWithExpiration in lib/
Drupal/ service_container/ Tests/ KeyValue/ DatabaseStorageExpirableTest.php - Tests CRUD functionality with expiration.
- DatabaseStorageExpirableTest::_testExpiration in lib/
Drupal/ service_container/ Tests/ KeyValue/ DatabaseStorageExpirableTest.php - Tests data expiration.
- StorageTestBase::cleanUp in lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php - StorageTestBase::_testCRUD in lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php - Tests CRUD operations.
- StorageTestBase::_testNonExistingKeys in lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php - Tests expected behavior for non-existing keys.
File
- lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php, line 273 - Contains Drupal\service_container\Tests\KeyValue\StorageTestBase.
Class
- StorageTestBase
- Base class for testing key-value storages.
Namespace
Drupal\service_container\Tests\KeyValueCode
protected function createStorage() {
$stores = array();
foreach ($this->collections as $i => $collection) {
$stores[$i] = \Drupal::service($this->factory)
->get($collection);
}
return $stores;
}