88use malkusch \lock \exception \LockReleaseException ;
99use malkusch \lock \mutex \PredisMutex ;
1010use PHPUnit \Framework \Attributes \Group ;
11+ use PHPUnit \Framework \Constraint \IsType ;
1112use PHPUnit \Framework \MockObject \MockObject ;
1213use PHPUnit \Framework \TestCase ;
1314use Predis \ClientInterface ;
@@ -62,7 +63,7 @@ public function testAddFailsToSetKey(): void
6263 {
6364 $ this ->client ->expects (self ::atLeastOnce ())
6465 ->method ('set ' )
65- ->with ('php-malkusch-lock:test ' , self :: isType ( ' string ' ), 'PX ' , 3500 , 'NX ' )
66+ ->with ('php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ), 'PX ' , 3500 , 'NX ' )
6667 ->willReturn (null );
6768
6869 $ this ->logger ->expects (self ::never ())
@@ -84,7 +85,7 @@ public function testAddErrors(): void
8485 {
8586 $ this ->client ->expects (self ::atLeastOnce ())
8687 ->method ('set ' )
87- ->with ('php-malkusch-lock:test ' , self :: isType ( ' string ' ), 'PX ' , 3500 , 'NX ' )
88+ ->with ('php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ), 'PX ' , 3500 , 'NX ' )
8889 ->willThrowException ($ this ->createMock (PredisException::class));
8990
9091 $ this ->logger ->expects (self ::once ())
@@ -104,12 +105,12 @@ public function testWorksNormally(): void
104105 {
105106 $ this ->client ->expects (self ::atLeastOnce ())
106107 ->method ('set ' )
107- ->with ('php-malkusch-lock:test ' , self :: isType ( ' string ' ), 'PX ' , 3500 , 'NX ' )
108+ ->with ('php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ), 'PX ' , 3500 , 'NX ' )
108109 ->willReturnSelf ();
109110
110111 $ this ->client ->expects (self ::once ())
111112 ->method ('eval ' )
112- ->with (self ::anything (), 1 , 'php-malkusch-lock:test ' , self :: isType ( ' string ' ))
113+ ->with (self ::anything (), 1 , 'php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ))
113114 ->willReturn (true );
114115
115116 $ executed = false ;
@@ -128,12 +129,12 @@ public function testEvalScriptFails(): void
128129 {
129130 $ this ->client ->expects (self ::atLeastOnce ())
130131 ->method ('set ' )
131- ->with ('php-malkusch-lock:test ' , self :: isType ( ' string ' ), 'PX ' , 3500 , 'NX ' )
132+ ->with ('php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ), 'PX ' , 3500 , 'NX ' )
132133 ->willReturnSelf ();
133134
134135 $ this ->client ->expects (self ::once ())
135136 ->method ('eval ' )
136- ->with (self ::anything (), 1 , 'php-malkusch-lock:test ' , self :: isType ( ' string ' ))
137+ ->with (self ::anything (), 1 , 'php-malkusch-lock:test ' , new IsType (IsType:: TYPE_STRING ))
137138 ->willThrowException ($ this ->createMock (PredisException::class));
138139
139140 $ this ->logger ->expects (self ::once ())
0 commit comments