@@ -23,19 +23,19 @@ public function testCtor()
23
23
24
24
public function testWillConnectToLocalIpWithDefaultPortIfTargetIsNotGiven ()
25
25
{
26
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->with ('127.0.0.1 ' , 6379 )->willReturn (Promise \reject (new \RuntimeException ()));
26
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->with ('127.0.0.1: 6379 ' )->willReturn (Promise \reject (new \RuntimeException ()));
27
27
$ this ->factory ->createClient ();
28
28
}
29
29
30
30
public function testWillConnectWithDefaultPort ()
31
31
{
32
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->with ('redis.example.com ' , 6379 )->willReturn (Promise \reject (new \RuntimeException ()));
32
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->with ('redis.example.com: 6379 ' )->willReturn (Promise \reject (new \RuntimeException ()));
33
33
$ this ->factory ->createClient ('redis.example.com ' );
34
34
}
35
35
36
36
public function testWillConnectToLocalIpWhenTargetIsLocalhost ()
37
37
{
38
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->with ('127.0.0.1 ' , 1337 )->willReturn (Promise \reject (new \RuntimeException ()));
38
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->with ('127.0.0.1: 1337 ' )->willReturn (Promise \reject (new \RuntimeException ()));
39
39
$ this ->factory ->createClient ('tcp://localhost:1337 ' );
40
40
}
41
41
@@ -44,7 +44,7 @@ public function testWillResolveIfConnectorResolves()
44
44
$ stream = $ this ->getMockBuilder ('React\Stream\Stream ' )->disableOriginalConstructor ()->getMock ();
45
45
$ stream ->expects ($ this ->never ())->method ('write ' );
46
46
47
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->willReturn (Promise \resolve ($ stream ));
47
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->willReturn (Promise \resolve ($ stream ));
48
48
$ promise = $ this ->factory ->createClient ();
49
49
50
50
$ this ->expectPromiseResolve ($ promise );
@@ -55,7 +55,7 @@ public function testWillWriteSelectCommandIfTargetContainsPath()
55
55
$ stream = $ this ->getMockBuilder ('React\Stream\Stream ' )->disableOriginalConstructor ()->getMock ();
56
56
$ stream ->expects ($ this ->once ())->method ('write ' )->with ("*2 \r\n$6 \r\nselect \r\n$4 \r\ndemo \r\n" );
57
57
58
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->willReturn (Promise \resolve ($ stream ));
58
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->willReturn (Promise \resolve ($ stream ));
59
59
$ this ->factory ->createClient ('tcp://127.0.0.1/demo ' );
60
60
}
61
61
@@ -64,13 +64,13 @@ public function testWillWriteAuthCommandIfTargetContainsUserInfo()
64
64
$ stream = $ this ->getMockBuilder ('React\Stream\Stream ' )->disableOriginalConstructor ()->getMock ();
65
65
$ stream ->expects ($ this ->once ())->method ('write ' )->with ("*2 \r\n$4 \r\nauth \r\n$11 \r\nhello:world \r\n" );
66
66
67
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->willReturn (Promise \resolve ($ stream ));
67
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->willReturn (Promise \resolve ($ stream ));
68
68
$ this ->
factory ->
createClient (
'tcp://hello:[email protected] ' );
69
69
}
70
70
71
71
public function testWillRejectIfConnectorRejects ()
72
72
{
73
- $ this ->connector ->expects ($ this ->once ())->method ('create ' )->with ('127.0.0.1 ' , 2 )->willReturn (Promise \reject (new \RuntimeException ()));
73
+ $ this ->connector ->expects ($ this ->once ())->method ('connect ' )->with ('127.0.0.1:2 ' )->willReturn (Promise \reject (new \RuntimeException ()));
74
74
$ promise = $ this ->factory ->createClient ('tcp://127.0.0.1:2 ' );
75
75
76
76
$ this ->expectPromiseReject ($ promise );
0 commit comments