public function register(ContainerBuilder
$container) { parent::
register($container);
$parameter[KeyValueFactory::DEFAULT_SETTING
] = 'keyvalue.expirable.database';
$container->
setParameter('factory.keyvalue.expirable',
$parameter);
} /**
* Tests CRUD functionality with expiration.
*/
public function testCRUDWithExpiration() { $stores =
$this->
createStorage();
// Verify that an item can be stored with setWithExpire().
// Use a random expiration in each test.
$stores[0
]->
setWithExpire('foo',
$this->objects
[0
],
rand(500, 100000
));
$this->
assertEquals($this->objects
[0
],
$stores[0
]->
get('foo'
));
// Verify that the other collection is not affected.
$this->
assertNull($stores[1
]->
get('foo'
));
// Verify that an item can be updated with setWithExpire().
$stores[0
]->
setWithExpire('foo',
$this->objects
[1
],
rand(500, 100000
));
$this->
assertEquals($this->objects
[1
],
$stores[0
]->
get('foo'
));