Test Doubles for PSR-16 simple cache
$ composer require --dev raigu/psr16-simple-cache-testdoubles
Caches in memory.
$sut = new \Raigu\TestDouble\Psr16\InMemoryCache;
$sut->set('1', 'a value');
assert($sut->has('1'))
assert($sut->get('1') === 'a value')
Behaves like a cache over network which has connection issues and is disconnected.
$sut = new \Raigu\TestDouble\Psr16\DisconnectedCacheStub;
assert($sut->set(1, 'value') === false);
assert($sut->has(1) === false);
assert($sut->get(1, 'default') === 'default');
assert($sut->getMultiple([1], 'default') === [1 => 'default']);
assert($sut->setMultiple([2 => 'value']) === false);
assert($sut->delete(1, 'value') === false);
assert($sut->deleteMultiple([1, 2]) === false);
assert($sut->clear() === false);)
$ composer test
$ composer specification
$ composer coverage