| @@ 101-112 (lines=12) @@ | ||
| 98 | /** |
|
| 99 | * @test |
|
| 100 | */ |
|
| 101 | public function shouldConnectAndAcquireAExistingLock() |
|
| 102 | { |
|
| 103 | $id = uniqid(); |
|
| 104 | ||
| 105 | $locker = $this->getLocker($id); |
|
| 106 | ||
| 107 | $redis = $this->getRedisClient(); |
|
| 108 | ||
| 109 | $redis->set($id, 'testvalue'); |
|
| 110 | ||
| 111 | self::assertTrue($locker->acquire()); |
|
| 112 | } |
|
| 113 | ||
| 114 | ||
| 115 | /** |
|
| @@ 118-129 (lines=12) @@ | ||
| 115 | /** |
|
| 116 | * @test |
|
| 117 | */ |
|
| 118 | public function shouldConnectAndAcquireALock() |
|
| 119 | { |
|
| 120 | $id = uniqid(); |
|
| 121 | ||
| 122 | $locker = $this->getLocker($id); |
|
| 123 | ||
| 124 | self::assertTrue($locker->acquire()); |
|
| 125 | ||
| 126 | $redis = $this->getRedisClient(); |
|
| 127 | ||
| 128 | self::assertTrue($redis->exists($id)); |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * @test |
|
| @@ 134-146 (lines=13) @@ | ||
| 131 | /** |
|
| 132 | * @test |
|
| 133 | */ |
|
| 134 | public function shouldConnectAndCheckIfLockIsAcquired() |
|
| 135 | { |
|
| 136 | ||
| 137 | $id = uniqid(); |
|
| 138 | ||
| 139 | $locker = $this->getLocker($id); |
|
| 140 | ||
| 141 | $redis = $this->getRedisClient(); |
|
| 142 | ||
| 143 | $redis->set($id, 'testvalue'); |
|
| 144 | ||
| 145 | self::assertTrue($locker->isAcquired()); |
|
| 146 | } |
|
| 147 | ||
| 148 | /** |
|
| 149 | * @test |
|