|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -namespace Spiral\RoadRunner\Symfony\Lock; |
| 5 | +namespace Spiral\RoadRunner\Symfony\Lock\Tests; |
6 | 6 |
|
7 | 7 | use PHPUnit\Framework\TestCase; |
| 8 | +use RoadRunner\Lock\LockInterface as RrLock; |
| 9 | +use Spiral\RoadRunner\Symfony\Lock\RoadRunnerStore; |
| 10 | +use Symfony\Component\Lock\Key; |
8 | 11 |
|
9 | 12 | final class RoadRunnerStoreTest extends TestCase |
10 | 13 | { |
| 14 | + public function testSave(): void |
| 15 | + { |
| 16 | + $rrLock = $this->createMock(RrLock::class); |
| 17 | + $rrLock->expects(self::once()) |
| 18 | + ->method('lock') |
| 19 | + ->with('resource-name'); |
| 20 | + $store = new RoadRunnerStore($rrLock); |
| 21 | + $store->save(new Key('resource-name')); |
| 22 | + } |
11 | 23 |
|
| 24 | + public function testExists(): void |
| 25 | + { |
| 26 | + $rrLock = $this->createMock(RrLock::class); |
| 27 | + $rrLock->expects(self::once()) |
| 28 | + ->method('exists') |
| 29 | + ->with('resource-name'); |
| 30 | + $store = new RoadRunnerStore($rrLock); |
| 31 | + $store->exists(new Key('resource-name')); |
| 32 | + } |
| 33 | + |
| 34 | + public function testPutOffExpiration(): void |
| 35 | + { |
| 36 | + $rrLock = $this->createMock(RrLock::class); |
| 37 | + $rrLock->expects(self::once()) |
| 38 | + ->method('updateTTL') |
| 39 | + ->with('resource-name', '*', 3600.0); |
| 40 | + $store = new RoadRunnerStore($rrLock); |
| 41 | + $store->putOffExpiration(new Key('resource-name'), 3600.0); |
| 42 | + } |
12 | 43 | } |
0 commit comments