Skip to content

Add Redis AUTH user/password support with updated docs and tests #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 3.x
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update FactoryStreamingClientTest to expect AUTH with username and pa…
…ssword (3 args)
  • Loading branch information
mauricioguim committed May 2, 2025
commit 16e17f669b9c7e2e17c0479db57d48c4e59daa12
14 changes: 7 additions & 7 deletions tests/Io/FactoryStreamingClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testWillWriteSelectCommandIfTargetContainsDbQueryParameter(): vo
public function testWillWriteAuthCommandIfRedisUriContainsUserInfo(): void
{
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$5\r\nhello\r\n$5\r\nworld\r\n");

$loop = $this->createMock(LoopInterface::class);
$loop->expects($this->once())->method('addTimer');
Expand All @@ -124,7 +124,7 @@ public function testWillWriteAuthCommandIfRedisUriContainsUserInfo(): void
public function testWillWriteAuthCommandIfRedisUriContainsEncodedUserInfo(): void
{
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nh@llo\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$0\r\n\r\n$5\r\nh@llo\r\n");

$loop = $this->createMock(LoopInterface::class);
$loop->expects($this->once())->method('addTimer');
Expand Down Expand Up @@ -166,7 +166,7 @@ public function testWillWriteAuthCommandIfTargetContainsEncodedPasswordQueryPara
public function testWillWriteAuthCommandIfRedissUriContainsUserInfo(): void
{
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$5\r\nhello\r\n$5\r\nworld\r\n");

$loop = $this->createMock(LoopInterface::class);
$loop->expects($this->once())->method('addTimer');
Expand Down Expand Up @@ -203,7 +203,7 @@ public function testWillNotWriteAnyCommandIfRedisUnixUriContainsNoPasswordOrDb()
public function testWillWriteAuthCommandIfRedisUnixUriContainsUserInfo(): void
{
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$5\r\nhello\r\n$5\r\nworld\r\n");

$loop = $this->createMock(LoopInterface::class);
$loop->expects($this->once())->method('addTimer');
Expand All @@ -218,7 +218,7 @@ public function testWillResolveWhenAuthCommandReceivesOkResponseIfRedisUriContai
{
$dataHandler = null;
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$0\r\n\r\n$5\r\nworld\r\n");
$stream->expects($this->exactly(2))->method('on')->withConsecutive(
['data', $this->callback(function ($arg) use (&$dataHandler) {
$dataHandler = $arg;
Expand All @@ -240,7 +240,7 @@ public function testWillRejectAndCloseAutomaticallyWhenAuthCommandReceivesErrorR
{
$dataHandler = null;
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$0\r\n\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('close');
$stream->expects($this->exactly(2))->method('on')->withConsecutive(
['data', $this->callback(function ($arg) use (&$dataHandler) {
Expand Down Expand Up @@ -277,7 +277,7 @@ public function testWillRejectAndCloseAutomaticallyWhenConnectionIsClosedWhileWa
{
$closeHandler = null;
$stream = $this->createMock(ConnectionInterface::class);
$stream->expects($this->once())->method('write')->with("*2\r\n$4\r\nauth\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('write')->with("*3\r\n$4\r\nauth\r\n$0\r\n\r\n$5\r\nworld\r\n");
$stream->expects($this->once())->method('close');
$stream->expects($this->exactly(2))->method('on')->withConsecutive(
['data', $this->anything()],
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy