macpaw / behat-redis-context
用于测试的 Behat Redis 上下文
v1.1.0
2024-07-30 13:37 UTC
Requires
- php: ^7.4 || ^8.0
- behat/behat: ^3.0
- predis/predis: ^1.0||^2.0
- symfony/dependency-injection: ^4.3 || ^5.0 || ^6.0 || ^7.0
- symfony/http-kernel: ^4.3 || ^5.0 || ^6.0 || ^7.0
- symfony/yaml: ^4.3 || ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- phpstan/phpstan: ^1.2
- phpunit/phpunit: ^9.5
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ^3.6
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 ...