codeception/module-redis
Codeception Redis module for functional and acceptance tests. Provides helpers to connect to Redis, flush/select databases, set/get keys, and assert cache and data state during tests, making Redis-backed features easy to verify in your test suite.
Start by installing via Composer: composer require --dev codeception/module-redis. Then enable it in your codeception.yml (or environment-specific config) under modules: enabled: [Redis]. Configure connection details under config: Redis: host: '127.0.0.1', port: 6379. Your first use case is typically redis cleanup between tests—e.g., in tests/_support/Helper/Functional.php, call $I->amInRedisDatabase(0); $I->flushRedis(); in _before() to ensure test isolation.
$I->seeInRedis('user:123'), $I->dontSeeInRedis('session:abc'), or $I->grabFromRedis('key') to inspect Redis state.amInRedisDatabase($db) to test multi-database setups (default is 0).seeHashInRedis('hashkey', ['field' => 'value']) and grabFromRedisAsJson('key') for structured data.FunctionalTester via _support/FunctionalTester.php (e.g., loginViaRedisSession()).codeception/module-doctrine or codeception/module-phpbrowser for end-to-end tests with layered state dependencies.port, database, and password match your test Redis instance—mismatches cause silent test failures.flushRedis() wipes all keys in the selected DB—avoid in shared test environments; consider select + flush + targeted del instead.$this->getModule('Redis')->getWebDriver()->_getResponse(); (though not applicable here) or var_dump($I->grabFromRedis('key')) to inspect raw data structures—especially for complex types (e.g., ZSETs)._support/Helper/Redis.php to add domain-specific helpers (e.g., createTestUserInRedis($id)).predis/predis directly in your tests.How can I help you explore Laravel packages today?