@@ -57,7 +57,11 @@ public function __call($name, $args)
57
57
$ this ->calls [] = [$ name , $ args ];
58
58
59
59
if (! in_array ($ name , ['subscribe ' , 'psubscribe ' , 'unsubscribe ' , 'punsubscribe ' , 'onMessage ' ])) {
60
- $ this ->redis ->__call ($ name , $ args );
60
+ if ($ name === 'eval ' ) {
61
+ $ this ->redis ->{$ name }(...$ args );
62
+ } else {
63
+ $ this ->redis ->__call ($ name , $ args );
64
+ }
61
65
}
62
66
63
67
return new PromiseResolver (
@@ -98,14 +102,34 @@ public function assertCalled($name)
98
102
return $ this ;
99
103
}
100
104
105
+ /**
106
+ * Check if the method got called.
107
+ *
108
+ * @param int $times
109
+ * @param string $name
110
+ * @return $this
111
+ */
112
+ public function assertCalledCount (int $ times , string $ name )
113
+ {
114
+ $ total = collect ($ this ->getCalledFunctions ())->filter (function ($ function ) use ($ name ) {
115
+ [$ calledName , ] = $ function ;
116
+
117
+ return $ calledName === $ name ;
118
+ });
119
+
120
+ PHPUnit::assertCount ($ times , $ total );
121
+
122
+ return $ this ;
123
+ }
124
+
101
125
/**
102
126
* Check if the method with args got called.
103
127
*
104
128
* @param string $name
105
129
* @param array $args
106
130
* @return $this
107
131
*/
108
- public function assertCalledWithArgs ($ name , array $ args )
132
+ public function assertCalledWithArgs (string $ name , array $ args )
109
133
{
110
134
foreach ($ this ->getCalledFunctions () as $ function ) {
111
135
[$ calledName , $ calledArgs ] = $ function ;
@@ -125,11 +149,12 @@ public function assertCalledWithArgs($name, array $args)
125
149
/**
126
150
* Check if the method with args got called an amount of times.
127
151
*
152
+ * @param int $times
128
153
* @param string $name
129
154
* @param array $args
130
155
* @return $this
131
156
*/
132
- public function assertCalledWithArgsCount ($ times = 1 , $ name , array $ args )
157
+ public function assertCalledWithArgsCount (int $ times, string $ name , array $ args )
133
158
{
134
159
$ total = collect ($ this ->getCalledFunctions ())->filter (function ($ function ) use ($ name , $ args ) {
135
160
[$ calledName , $ calledArgs ] = $ function ;
@@ -148,7 +173,7 @@ public function assertCalledWithArgsCount($times = 1, $name, array $args)
148
173
* @param string $name
149
174
* @return $this
150
175
*/
151
- public function assertNotCalled ($ name )
176
+ public function assertNotCalled (string $ name )
152
177
{
153
178
foreach ($ this ->getCalledFunctions () as $ function ) {
154
179
[$ calledName , ] = $ function ;
@@ -172,7 +197,7 @@ public function assertNotCalled($name)
172
197
* @param array $args
173
198
* @return $this
174
199
*/
175
- public function assertNotCalledWithArgs ($ name , array $ args )
200
+ public function assertNotCalledWithArgs (string $ name , array $ args )
176
201
{
177
202
foreach ($ this ->getCalledFunctions () as $ function ) {
178
203
[$ calledName , $ calledArgs ] = $ function ;
@@ -192,11 +217,12 @@ public function assertNotCalledWithArgs($name, array $args)
192
217
/**
193
218
* Check if the method with args got called an amount of times.
194
219
*
220
+ * @param int $times
195
221
* @param string $name
196
222
* @param array $args
197
223
* @return $this
198
224
*/
199
- public function assertNotCalledWithArgsCount ($ times = 1 , $ name , array $ args )
225
+ public function assertNotCalledWithArgsCount (int $ times, string $ name , array $ args )
200
226
{
201
227
$ total = collect ($ this ->getCalledFunctions ())->filter (function ($ function ) use ($ name , $ args ) {
202
228
[$ calledName , $ calledArgs ] = $ function ;
0 commit comments