@@ -88,13 +88,15 @@ public function memoizeCallableRefreshRequest()
8888 };
8989
9090 $ client = $ this ->getPredisMock ();
91- $ client ->expects ($ this ->at ( 0 ))->method ('get ' )->with (
91+ $ client ->expects ($ this ->once ( ))->method ('get ' )->with (
9292 $ this ->equalTo ("{$ key }.runtime " )
9393 )->will ($ this ->returnValue (.2 ));
94- $ client ->expects ($ this ->at (1 ))->method ('pttl ' )->with ($ this ->equalTo ($ key ))->will ($ this ->returnValue (10 ));
95- $ client ->expects ($ this ->at (2 ))->method ('set ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cachedValue ));
96- $ client ->expects ($ this ->at (3 ))->method ('set ' )->with ($ this ->equalTo ("{$ key }.runtime " ), $ this ->lessThan (1 ));
97- $ client ->expects ($ this ->at (4 ))->method ('expire ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cacheTime ));
94+ $ client ->expects ($ this ->once ())->method ('pttl ' )->with ($ this ->equalTo ($ key ))->will ($ this ->returnValue (10 ));
95+ $ client ->expects ($ this ->exactly (2 ))->method ('set ' )->withConsecutive (
96+ [$ this ->equalTo ($ key ), $ this ->equalTo ($ cachedValue )],
97+ [$ this ->equalTo ("{$ key }.runtime " ), $ this ->lessThan (1 )]
98+ );
99+ $ client ->expects ($ this ->once ())->method ('expire ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cacheTime ));
98100
99101 $ memoizer = new Predis ($ client , false , 100 );
100102
@@ -121,10 +123,12 @@ public function memoizeCallableWithUncachedKey()
121123 };
122124
123125 $ client = $ this ->getPredisMock ();
124- $ client ->expects ($ this ->at (0 ))->method ('get ' )->with ($ this ->equalTo ($ key ))->will ($ this ->returnValue (null ));
125- $ client ->expects ($ this ->at (1 ))->method ('set ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cachedValue ));
126- $ client ->expects ($ this ->at (2 ))->method ('set ' )->with ($ this ->equalTo ("{$ key }.runtime " ), $ this ->lessThan (1 ));
127- $ client ->expects ($ this ->at (3 ))->method ('expire ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cacheTime ));
126+ $ client ->expects ($ this ->once ())->method ('get ' )->with ($ this ->equalTo ($ key ))->will ($ this ->returnValue (null ));
127+ $ client ->expects ($ this ->exactly (2 ))->method ('set ' )->withConsecutive (
128+ [$ this ->equalTo ($ key ), $ this ->equalTo ($ cachedValue )],
129+ [$ this ->equalTo ("{$ key }.runtime " ), $ this ->lessThan (1 )]
130+ );
131+ $ client ->expects ($ this ->once ())->method ('expire ' )->with ($ this ->equalTo ($ key ), $ this ->equalTo ($ cacheTime ));
128132
129133 $ memoizer = new Predis ($ client );
130134
0 commit comments