Download the PHP package josiasmontag/laravel-redis-mock without Composer
On this page you can find all versions of the php package josiasmontag/laravel-redis-mock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download josiasmontag/laravel-redis-mock
More information about josiasmontag/laravel-redis-mock
Files in josiasmontag/laravel-redis-mock
Package laravel-redis-mock
Short Description This Laravel package provides a Redis mock for your tests
License MIT
Homepage https://github.com/josiasmontag/laravel-redis-mock
Informations about the package laravel-redis-mock
Laravel Redis Mock
This Laravel package provides a Redis mock for your tests. It depends on Redis PHP Mock.
This makes it possible to run your tests without any local Redis server running!
Installation & Usage
To get started, use Composer to add the package to your project's dependencies:
composer require josiasmontag/laravel-redis-mock
This package adds a new mock
Redis client.
In config/database.php
, make the Redis client configurable via environment variable:
Now, you can switch to the mock
client in your .env.testing
:
Alternatively, you can switch to the mock in your phpunit.xml
:
Done! Your tests should work without a local redis server running.
Package Development
If you are using Redis as part of a Laravel package, you should already have a TestCase.php
that is extending Orchestra\Testbench\Testcase
.
Within this file you should add RedisMockServiceProvider
to getPackageProviders
method
e.g.
All versions of laravel-redis-mock with dependencies
laravel/framework Version ^5.8.30|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
predis/predis Version ^1.1|^2.0|^3.0
m6web/redis-mock Version ^4.2|^5.0