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 storage adapters, not a runtime dependency. It provides shared test cases for validating cache adapter implementations (e.g., Redis, Memcached, filesystem).Illuminate/Cache), this package is designed for Laminas Cache adapters, which may still be relevant if:
devDependencies without runtime overhead.Cache::store() or Cache::tags()), but this is expected since it’s Laminas-focused.laminas/laminas-cache (v4+), which may conflict with Laravel’s illuminate/cache if both are loaded. Mitigation: Use composer’s replace or autoload isolation (e.g., psr-4 prefixes).Why Laminas Cache?
Test Scope
CI/CD Impact
Long-Term Maintenance
laravel/cache-testing) that could reduce dependency sprawl?Illuminate/Contracts/Cache).composer require --dev laminas/laminas-cache-storage-adapter-test
MyRedisAdapter), extend:
use Laminas\Cache\Storage\Adapter\RedisAdapter;
use Laminas\Cache\Storage\Adapter\Test\RedisAdapterTest;
class MyRedisAdapterTest extends RedisAdapterTest {
protected function createAdapter(): RedisAdapter { ... }
}
phpunit.xml:
<testsuite name="Cache">
<directory>./tests/Cache</directory>
</testsuite>
Cache::store(), you’ll need to bridge Laminas adapters to Laravel’s Store interface.Cache::extend('laminas_redis', function () {
$adapter = new \Laminas\Cache\Storage\Adapter\RedisAdapter();
return new \Illuminate\Cache\Repository(
new \Illuminate\Cache\StoreWrapper(
new \Laminas\Cache\Storage\CachePool($adapter)
)
);
});
@group cache in Laravel tests to run Laminas-specific tests separately.TestCase bootstrapping).laminas/laminas-cache (v4+), which may need composer conflict resolution if Laravel’s illuminate/cache is also used.composer.json replaces or namespace isolation.--group cache to run only Laminas tests in parallel.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Test flakiness (e.g., Redis timeouts) | False negatives in CI | Mock external services or use deterministic backends (e.g., filesystem). |
| Laminas Cache version mismatch | Tests break if laminas/laminas-cache is outdated |
Pin version in composer.json. |
| Laravel/Laminas adapter bridge issues | Cache data corruption or silent failures | Write integration tests for the bridge layer. |
| CI environment misconfiguration | Tests fail due to missing cache backend | Use Dockerized test environments. |
composer.json with dev dependency.TESTING.md in your repo explaining:
How can I help you explore Laravel packages today?