macpaw / behat-redis-context
Behat redis context for testing
Installs: 82 286
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 10
Forks: 0
Open Issues: 1
Type:symfony-bundle
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-10-21 09:55:51 UTC
README
Symfony Behat Redis Context is a package that integrates Redis operations with Behat for behavior-driven development (BDD). This context allows you to store, retrieve, and validate data in Redis as part of your Behat testing scenarios. It's useful when testing applications that depend on Redis for caching, session storage, or data management.
This documentation provides step-by-step guides for installing the package and utilizing each Redis-related step within Behat scenarios.
How to Install Symfony Behat Redis Context
To install Symfony Behat Redis Context, follow these steps:
- Add the package to your project using composer:
composer require --dev macpaw/behat-redis-context
For detailed steps and configuration, refer to the Installation Steps
RedisContext Documentation
Below are the available Redis operations that you can use in your Behat tests. Each step integrates seamlessly with Redis to ensure data is stored, retrieved, or validated as expected.
Redis Step Definitions:
-
Check Any Value by Redis Key
Verifies if any value is stored in Redis under a specific key. -
Check Array Value Stored in Redis
Ensures that the stored array or hash in Redis matches the expected structure. -
Check if Key Exists in Redis
Checks whether a specific key exists in Redis. -
Check Serialized Value in Redis
Verifies that a serialized value stored in Redis matches the expected serialized value. -
Check String Value in Redis
Validates if a string value in Redis matches the expected value. -
Clean Redis Database in Test
Automatically flushes the Redis database before running a scenario to ensure a clean state. -
Store Serialized Value in Redis
Serializes and stores a value in Redis with a given key. -
Store String Value in Redis
Stores a simple string value in Redis under the specified key.
RedisFixtureContext Documentation
Here you can find detailed documentation about using Redis fixtures in Behat:
-
How It Works
Learn about the inner workings of the RedisFixtureContext and how it integrates with your Behat tests. -
How to Load Fixture Data into Redis
A step-by-step guide on how to load predefined data fixtures into Redis using YAML files in Behat. -
Handling Missing Fixture Files
What to do when a specified fixture file is missing and how to handle such errors in your tests.