laminas/laminas-cache-storage-adapter-test
Test adapter for laminas-cache storage, providing utilities for testing cache implementations. Useful in CI and unit tests to verify behavior of cache adapters and storage plugins within Laminas applications.
laminas-cache adapters (e.g., Redis, Memcached, filesystem). Eliminates reinventing test logic for core cache operations (TTL, eviction, serialization).PSR-6/PSR-16 by providing integration tests for both interfaces, ensuring compatibility with modern PHP ecosystems (e.g., Symfony, Laravel via laminas/laminas-cache).laminas-cache adapters (e.g., laminas-cache-redis) can reuse these tests to ensure backward compatibility.Adopt When:
laminas/laminas-cache v3+ or PSR-6/PSR-16 cache adapters** and needs standardized test coverage.Look Elsewhere When:
laminas-cache integration."This package lets us reduce technical debt in our caching layer by standardizing how we test cache adapters—whether Redis, Memcached, or custom solutions. It’s like having a ‘golden test suite’ for all cache backends, ensuring reliability without reinventing the wheel. For example, if we’re evaluating a new cache provider or building a hybrid system, this cuts testing time by 30–50% while improving consistency. It’s a low-risk, high-reward investment for scalability."
*"If you’re working on any cache adapter (even a one-off solution), this package gives you:
laminas-cache v4, so you won’t need to rewrite tests later.
Install it as a dev dependency (composer require --dev laminas/laminas-cache-storage-adapter-test), extend the abstract test classes, and instantly get robust test coverage for your adapter.""Need to test a custom cache adapter? Instead of writing boilerplate tests for getItem(), setItem(), or expiry logic, extend AbstractCacheItemPoolIntegrationTest or `AbstractSimpleCacheIntegrationTest. It handles edge cases like:
use Laminas\Cache\Storage\Adapter\Test\AbstractCacheItemPoolIntegrationTest;
class MyRedisAdapterTest extends AbstractCacheItemPoolIntegrationTest {
protected function createCachePool(): CacheItemPoolInterface {
return new MyRedisAdapter();
}
}
```"
How can I help you explore Laravel packages today?