|
11 | 11 | use malkusch\lock\mutex\RedisMutex; |
12 | 12 | use phpmock\environment\SleepEnvironmentBuilder; |
13 | 13 | use phpmock\phpunit\PHPMock; |
| 14 | +use PHPUnit\Framework\Attributes\DataProvider; |
| 15 | +use PHPUnit\Framework\Attributes\Group; |
14 | 16 | use PHPUnit\Framework\MockObject\MockObject; |
15 | 17 | use PHPUnit\Framework\TestCase; |
16 | 18 |
|
17 | 19 | /** |
18 | 20 | * @group redis |
19 | 21 | */ |
| 22 | +#[Group('redis')] |
20 | 23 | class RedisMutexTest extends TestCase |
21 | 24 | { |
22 | 25 | use PHPMock; |
@@ -63,6 +66,7 @@ static function ($id): array { |
63 | 66 | * |
64 | 67 | * @dataProvider provideMinorityCases |
65 | 68 | */ |
| 69 | + #[DataProvider('provideMinorityCases')] |
66 | 70 | public function testTooFewServerToAcquire(int $count, int $available): void |
67 | 71 | { |
68 | 72 | $this->expectException(LockAcquireException::class); |
@@ -98,6 +102,7 @@ static function () use (&$i, $available): bool { |
98 | 102 | * |
99 | 103 | * @dataProvider provideMajorityCases |
100 | 104 | */ |
| 105 | + #[DataProvider('provideMajorityCases')] |
101 | 106 | public function testFaultTolerance(int $count, int $available): void |
102 | 107 | { |
103 | 108 | $mutex = $this->buildRedisMutex($count); |
@@ -131,6 +136,7 @@ static function () use (&$i, $available): bool { |
131 | 136 | * |
132 | 137 | * @dataProvider provideMinorityCases |
133 | 138 | */ |
| 139 | + #[DataProvider('provideMinorityCases')] |
134 | 140 | public function testAcquireTooFewKeys($count, $available): void |
135 | 141 | { |
136 | 142 | $this->expectException(TimeoutException::class); |
@@ -163,6 +169,7 @@ static function () use (&$i, $available): bool { |
163 | 169 | * |
164 | 170 | * @dataProvider provideTimingOutCases |
165 | 171 | */ |
| 172 | + #[DataProvider('provideTimingOutCases')] |
166 | 173 | public function testTimingOut(int $count, float $timeout, float $delay): void |
167 | 174 | { |
168 | 175 | $timeoutStr = (string) round($timeout, 6); |
@@ -210,6 +217,7 @@ public static function provideTimingOutCases(): iterable |
210 | 217 | * |
211 | 218 | * @dataProvider provideMajorityCases |
212 | 219 | */ |
| 220 | + #[DataProvider('provideMajorityCases')] |
213 | 221 | public function testAcquireWithMajority(int $count, int $available): void |
214 | 222 | { |
215 | 223 | $mutex = $this->buildRedisMutex($count); |
@@ -239,6 +247,7 @@ static function () use (&$i, $available): bool { |
239 | 247 | * |
240 | 248 | * @dataProvider provideMinorityCases |
241 | 249 | */ |
| 250 | + #[DataProvider('provideMinorityCases')] |
242 | 251 | public function testTooFewServersToRelease(int $count, int $available): void |
243 | 252 | { |
244 | 253 | $mutex = $this->buildRedisMutex($count); |
@@ -274,6 +283,7 @@ static function () use (&$i, $available): bool { |
274 | 283 | * |
275 | 284 | * @dataProvider provideMinorityCases |
276 | 285 | */ |
| 286 | + #[DataProvider('provideMinorityCases')] |
277 | 287 | public function testReleaseTooFewKeys(int $count, int $available): void |
278 | 288 | { |
279 | 289 | $mutex = $this->buildRedisMutex($count); |
|
0 commit comments