定制 josiasmontag/laravel-redis-mock 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

josiasmontag/laravel-redis-mock

最新稳定版本:1.3.5

Composer 安装命令:

composer require josiasmontag/laravel-redis-mock

包简介

This Laravel package provides a Redis mock for your tests

README 文档

README

Build Status Total Downloads Latest Stable Version License

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:

    'redis' => [

        'client' => env('REDIS_CLIENT', 'predis'),

        ...
        
    ],

Now, you can switch to the mock client in your .env.testing:

REDIS_CLIENT=mock

Alternatively, you can switch to the mock in your phpunit.xml:

<env name="REDIS_CLIENT" value="mock"/>

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.

    /**
     * @param $app
     * @return string[]
     */
    protected function getPackageProviders($app): array
    {
        return [
            YourPackageServiceProvider::class,
            \Lunaweb\RedisMock\Providers\RedisMockServiceProvider::class
        ];
    }

统计信息

  • 总下载量: 1.67M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 46
  • 点击次数: 1
  • 依赖项目数: 15
  • 推荐数: 0

GitHub 信息

  • Stars: 46
  • Watchers: 3
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-03