8
8
use malkusch \lock \exception \LockReleaseException ;
9
9
use malkusch \lock \mutex \PredisMutex ;
10
10
use PHPUnit \Framework \Attributes \Group ;
11
+ use PHPUnit \Framework \Constraint \IsType ;
11
12
use PHPUnit \Framework \MockObject \MockObject ;
12
13
use PHPUnit \Framework \TestCase ;
13
14
use Predis \ClientInterface ;
@@ -62,7 +63,7 @@ public function testAddFailsToSetKey(): void
62
63
{
63
64
$ this ->client ->expects (self ::atLeastOnce ())
64
65
->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 ' )
66
67
->willReturn (null );
67
68
68
69
$ this ->logger ->expects (self ::never ())
@@ -84,7 +85,7 @@ public function testAddErrors(): void
84
85
{
85
86
$ this ->client ->expects (self ::atLeastOnce ())
86
87
->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 ' )
88
89
->willThrowException ($ this ->createMock (PredisException::class));
89
90
90
91
$ this ->logger ->expects (self ::once ())
@@ -104,12 +105,12 @@ public function testWorksNormally(): void
104
105
{
105
106
$ this ->client ->expects (self ::atLeastOnce ())
106
107
->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 ' )
108
109
->willReturnSelf ();
109
110
110
111
$ this ->client ->expects (self ::once ())
111
112
->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 ))
113
114
->willReturn (true );
114
115
115
116
$ executed = false ;
@@ -128,12 +129,12 @@ public function testEvalScriptFails(): void
128
129
{
129
130
$ this ->client ->expects (self ::atLeastOnce ())
130
131
->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 ' )
132
133
->willReturnSelf ();
133
134
134
135
$ this ->client ->expects (self ::once ())
135
136
->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 ))
137
138
->willThrowException ($ this ->createMock (PredisException::class));
138
139
139
140
$ this ->logger ->expects (self ::once ())
0 commit comments