macpaw/behat-redis-context

用于测试的 Behat Redis 上下文

安装数: 71,571

依赖项: 0

建议者: 0

安全性: 0

星标: 6

关注者: 10

分支: 0

开放问题: 1

类型:symfony-bundle

v1.1.0 2024-07-30 13:37 UTC

This package is auto-updated.

Last update: 2024-08-30 13:45:27 UTC


README

安装

步骤 1:下载 Bundle

打开命令控制台,进入您的项目目录并执行

使用 Symfony Flex 的应用程序 进行中

$ composer require --dev macpaw/behat-redis-context

不使用 Symfony Flex 的应用程序

打开命令控制台,进入您的项目目录并执行以下命令以下载此 Bundle 的最新稳定版本

$ composer require --dev macpaw/behat-redis-context

此命令需要您已全局安装 Composer,请参阅 Composer 文档中的安装章节

然后,将 Bundle 添加到项目的 app/AppKernel.php 文件中已注册的 Bundle 列表以启用该 Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            BehatRedisContextBundle\BehatRedisContextBundle::class => ['test' => true],
        );

        // ...
    }

    // ...
}

为 Behat Redis 上下文创建配置

config/packages/test/behat_redis_context.yaml

behat_redis_context:
    dataFixturesPath: ""

步骤 2:更改到包含您的测试数据的目录的路径

config/packages/test/behat_redis_context.yaml

behat_redis_context:
    dataFixturesPath: "your path"

步骤 3:更改到包含您的测试数据的目录的路径

config/services_test.yaml

Predis\ClientInterface: 'Your Redis Client'

如果您使用 Symfony Redis Bundle 的示例

Predis\ClientInterface: '@SymfonyBundles\RedisBundle\Redis\ClientInterface'

步骤 4:配置 Behat

转到 behat.yml

...
  contexts:
    - BehatRedisContext\Context\RedisContext
    - BehatRedisContext\Context\RedisFixturesContext
...