- Can I use this package to test Laravel’s built-in cache drivers like file or database?
- No, this package is designed for PSR-6/PSR-16 compliant cache adapters. Laravel’s file or database drivers may not fully align with Laminas’ test expectations, especially for features like key length limits or tagging. Focus on custom PSR adapters (e.g., Redis, Memcached) instead.
- How do I install this for Laravel testing?
- Add it as a dev dependency via Composer: `composer require --dev laminas/laminas-cache-storage-adapter-test`. No runtime configuration is needed—it’s purely for test suites. Ensure your Laravel project uses PHPUnit 10+ (default in Laravel 9+).
- Will this work with Laravel’s Cache facade (e.g., Cache::store('redis'))?
- Yes, but you’ll need to bridge Laravel’s facade to PSR interfaces. Use `PsrCacheStore` (Laravel 9+) to wrap your cache store, then extend Laminas’ test classes. Override methods for Laravel-specific behaviors like tags or events if needed.
- Does this package support Laravel 8.x or older versions?
- Officially, it targets PHP 8.0+ and PSR-6/PSR-16 v2/v3, which aligns with Laravel 9+/10+. For Laravel 8.x, you may need polyfills for PSR-16 (SimpleCache) or adjust tests to handle version-specific quirks, as Laravel 8’s PSR support is less mature.
- How do I extend the test suite for my custom PSR-6 cache adapter?
- Extend `AbstractCacheItemPoolIntegrationTest` or `AbstractSimpleCacheIntegrationTest` and override `getCacheItemPool()` to return your PSR-6 adapter instance. Example: `class MyRedisTest extends AbstractCacheItemPoolIntegrationTest { protected function getCacheItemPool() { return new RedisCacheItemPool(); } }`. Run tests via PHPUnit.
- Will this slow down my CI/CD pipeline significantly?
- The package includes comprehensive test suites, so adding it may increase build times. Scope tests to critical adapters (e.g., Redis) and use feature flags to toggle Laminas tests in CI. Benchmark your current test suite size against Laminas’ coverage to assess impact.
- Are there alternatives for testing Laravel cache implementations?
- For Laravel-specific testing, consider `phpunit/lazy-cache` or Laravel’s built-in `Illuminate/Cache` tests. However, those lack PSR-6/PSR-16 validation depth. This package fills that gap for custom or third-party PSR-compliant adapters, especially if you’re integrating Laminas-style caches.
- How do I handle Laravel-specific features like tags or events in Laminas tests?
- Override test methods to account for Laravel quirks. For example, add a `testTagging()` method to verify `Cache::tags()` behavior. Use `PsrCacheStore` to wrap Laravel’s cache and extend Laminas’ test classes while mocking or stubbing Laravel-specific logic where needed.
- Does this package support testing PSR-16 (SimpleCache) adapters?
- Yes, it includes `AbstractSimpleCacheIntegrationTest` for PSR-16 validation. Ensure your Laravel project uses a PSR-16-compliant adapter (e.g., `spatie/laravel-cache-dynamodb`) and wrap it with `PsrCacheStore` to integrate with Laminas’ test suite.
- What Laravel cache drivers are *not* compatible with this package?
- Avoid Laravel’s default file, database, or array drivers, as they may not fully implement PSR-6/PSR-16 (e.g., missing key length limits or namespace support). Focus on custom PSR adapters or third-party packages like Redis, Memcached, or DynamoDB that explicitly support PSR standards.