16
16
use Symfony \Component \Lock \BlockingSharedLockStoreInterface ;
17
17
use Symfony \Component \Lock \BlockingStoreInterface ;
18
18
use Symfony \Component \Lock \Exception \LockConflictedException ;
19
+ use Symfony \Component \Lock \Exception \LockReleasingException ;
19
20
use Symfony \Component \Lock \Key ;
20
21
use Symfony \Component \Lock \Lock ;
21
22
use Symfony \Component \Lock \PersistingStoreInterface ;
@@ -30,7 +31,7 @@ class LockTest extends TestCase
30
31
public function testAcquireNoBlocking ()
31
32
{
32
33
$ key = new Key (uniqid (__METHOD__ , true ));
33
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
34
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
34
35
$ lock = new Lock ($ key , $ store );
35
36
36
37
$ store
@@ -46,7 +47,7 @@ public function testAcquireNoBlocking()
46
47
public function testAcquireNoBlockingWithPersistingStoreInterface ()
47
48
{
48
49
$ key = new Key (uniqid (__METHOD__ , true ));
49
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
50
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
50
51
$ lock = new Lock ($ key , $ store );
51
52
52
53
$ store
@@ -100,7 +101,7 @@ public function testAcquireBlockingRetryWithPersistingStoreInterface()
100
101
public function testAcquireReturnsFalse ()
101
102
{
102
103
$ key = new Key (uniqid (__METHOD__ , true ));
103
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
104
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
104
105
$ lock = new Lock ($ key , $ store );
105
106
106
107
$ store
@@ -117,7 +118,7 @@ public function testAcquireReturnsFalse()
117
118
public function testAcquireReturnsFalseStoreInterface ()
118
119
{
119
120
$ key = new Key (uniqid (__METHOD__ , true ));
120
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
121
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
121
122
$ lock = new Lock ($ key , $ store );
122
123
123
124
$ store
@@ -153,7 +154,7 @@ public function testAcquireBlockingWithBlockingStoreInterface()
153
154
public function testAcquireSetsTtl ()
154
155
{
155
156
$ key = new Key (uniqid (__METHOD__ , true ));
156
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
157
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
157
158
$ lock = new Lock ($ key , $ store , 10 );
158
159
159
160
$ store
@@ -173,7 +174,7 @@ public function testAcquireSetsTtl()
173
174
public function testRefresh ()
174
175
{
175
176
$ key = new Key (uniqid (__METHOD__ , true ));
176
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
177
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
177
178
$ lock = new Lock ($ key , $ store , 10 );
178
179
179
180
$ store
@@ -190,7 +191,7 @@ public function testRefresh()
190
191
public function testRefreshCustom ()
191
192
{
192
193
$ key = new Key (uniqid (__METHOD__ , true ));
193
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
194
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
194
195
$ lock = new Lock ($ key , $ store , 10 );
195
196
196
197
$ store
@@ -207,7 +208,7 @@ public function testRefreshCustom()
207
208
public function testIsAquired ()
208
209
{
209
210
$ key = new Key (uniqid (__METHOD__ , true ));
210
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
211
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
211
212
$ lock = new Lock ($ key , $ store , 10 );
212
213
213
214
$ store
@@ -221,7 +222,7 @@ public function testIsAquired()
221
222
public function testRelease ()
222
223
{
223
224
$ key = new Key (uniqid (__METHOD__ , true ));
224
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
225
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
225
226
$ lock = new Lock ($ key , $ store , 10 );
226
227
227
228
$ store
@@ -241,7 +242,7 @@ public function testRelease()
241
242
public function testReleaseStoreInterface ()
242
243
{
243
244
$ key = new Key (uniqid (__METHOD__ , true ));
244
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
245
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
245
246
$ lock = new Lock ($ key , $ store , 10 );
246
247
247
248
$ store
@@ -298,9 +299,9 @@ public function testNoAutoReleaseWhenNotConfigured()
298
299
299
300
public function testReleaseThrowsExceptionWhenDeletionFail ()
300
301
{
301
- $ this ->expectException (\ Symfony \ Component \ Lock \ Exception \ LockReleasingException::class);
302
+ $ this ->expectException (LockReleasingException::class);
302
303
$ key = new Key (uniqid (__METHOD__ , true ));
303
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
304
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
304
305
$ lock = new Lock ($ key , $ store , 10 );
305
306
306
307
$ store
@@ -319,9 +320,9 @@ public function testReleaseThrowsExceptionWhenDeletionFail()
319
320
320
321
public function testReleaseThrowsExceptionIfNotWellDeleted ()
321
322
{
322
- $ this ->expectException (\ Symfony \ Component \ Lock \ Exception \ LockReleasingException::class);
323
+ $ this ->expectException (LockReleasingException::class);
323
324
$ key = new Key (uniqid (__METHOD__ , true ));
324
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
325
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
325
326
$ lock = new Lock ($ key , $ store , 10 );
326
327
327
328
$ store
@@ -340,10 +341,10 @@ public function testReleaseThrowsExceptionIfNotWellDeleted()
340
341
341
342
public function testReleaseThrowsAndLog ()
342
343
{
343
- $ this ->expectException (\ Symfony \ Component \ Lock \ Exception \ LockReleasingException::class);
344
+ $ this ->expectException (LockReleasingException::class);
344
345
$ key = new Key (uniqid (__METHOD__ , true ));
345
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
346
- $ logger = $ this ->getMockBuilder (LoggerInterface::class)-> getMock ( );
346
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
347
+ $ logger = $ this ->createMock (LoggerInterface::class);
347
348
$ lock = new Lock ($ key , $ store , 10 , true );
348
349
$ lock ->setLogger ($ logger );
349
350
@@ -371,7 +372,7 @@ public function testReleaseThrowsAndLog()
371
372
public function testExpiration ($ ttls , $ expected )
372
373
{
373
374
$ key = new Key (uniqid (__METHOD__ , true ));
374
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
375
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
375
376
$ lock = new Lock ($ key , $ store , 10 );
376
377
377
378
foreach ($ ttls as $ ttl ) {
@@ -390,7 +391,7 @@ public function testExpiration($ttls, $expected)
390
391
public function testExpirationStoreInterface ($ ttls , $ expected )
391
392
{
392
393
$ key = new Key (uniqid (__METHOD__ , true ));
393
- $ store = $ this ->getMockBuilder (PersistingStoreInterface::class)-> getMock ( );
394
+ $ store = $ this ->createMock (PersistingStoreInterface::class);
394
395
$ lock = new Lock ($ key , $ store , 10 );
395
396
396
397
foreach ($ ttls as $ ttl ) {
0 commit comments