Skip to content

Commit 613abe7

Browse files
committed
Replace deprecated PHPUnit 11.5.0 usages
1 parent 3fd576b commit 613abe7

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/mutex/PgAdvisoryLockMutexTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace malkusch\lock\Tests\mutex;
66

77
use malkusch\lock\mutex\PgAdvisoryLockMutex;
8+
use PHPUnit\Framework\Constraint\IsType;
89
use PHPUnit\Framework\MockObject\MockObject;
910
use PHPUnit\Framework\TestCase;
1011

@@ -44,7 +45,7 @@ public function testAcquireLock(): void
4445
->method('execute')
4546
->with(
4647
self::logicalAnd(
47-
self::isType('array'),
48+
new IsType(IsType::TYPE_ARRAY),
4849
self::countOf(2),
4950
self::callback(function (...$arguments): bool {
5051
if ($this->isPhpunit9x()) { // https://github.com/sebastianbergmann/phpunit/issues/5891
@@ -76,7 +77,7 @@ public function testReleaseLock(): void
7677
->method('execute')
7778
->with(
7879
self::logicalAnd(
79-
self::isType('array'),
80+
new IsType(IsType::TYPE_ARRAY),
8081
self::countOf(2),
8182
self::callback(function (...$arguments): bool {
8283
if ($this->isPhpunit9x()) { // https://github.com/sebastianbergmann/phpunit/issues/5891

tests/mutex/PredisMutexTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use malkusch\lock\exception\LockReleaseException;
99
use malkusch\lock\mutex\PredisMutex;
1010
use PHPUnit\Framework\Attributes\Group;
11+
use PHPUnit\Framework\Constraint\IsType;
1112
use PHPUnit\Framework\MockObject\MockObject;
1213
use PHPUnit\Framework\TestCase;
1314
use 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

Comments
 (0)