public function KeyValueFactoryTest::testGetPersistent in MongoDB 8.2
Test the collections provided by the persistent Key-Value factory.
Throws
\Exception
File
- modules/
mongodb_storage/ tests/ src/ Kernel/ KeyValueFactoryTest.php, line 42
Class
- KeyValueFactoryTest
- Tests the KeyValueFactory.
Namespace
Drupal\Tests\mongodb_storage\KernelCode
public function testGetPersistent() {
/** @var \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $factory */
$factory = $this->container
->get(Storage::SERVICE_KV);
$store = $factory
->get(static::COLLECTION);
$this
->assertInstanceOf(KeyValueStore::class, $store, "Store is a MongoDB key-value");
$this
->assertNotInstanceOf(KeyValueStoreExpirable::class, $store, "Store is not an expirable key-value");
$actual = $store
->getCollectionName();
$this
->assertEquals(static::COLLECTION, $actual, 'Collection name matches');
}