@@ 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 |
|
@@ 151-164 (lines=14) @@ | ||
148 | /** |
|
149 | * @test |
|
150 | */ |
|
151 | public function shouldConnectAndDestroyALock() |
|
152 | { |
|
153 | $id = uniqid(); |
|
154 | ||
155 | $locker = $this->getLocker($id); |
|
156 | ||
157 | $redis = $this->getRedisClient(); |
|
158 | ||
159 | $redis->set($id, 'testvalue'); |
|
160 | ||
161 | $locker->destroy(); |
|
162 | ||
163 | self::assertFalse($redis->exists($id)); |
|
164 | } |
|
165 | ||
166 | /** |
|
167 | * @test |
|
@@ 169-180 (lines=12) @@ | ||
166 | /** |
|
167 | * @test |
|
168 | */ |
|
169 | public function shouldConnectAndDestroyANotExistingLock() |
|
170 | { |
|
171 | $id = uniqid(); |
|
172 | ||
173 | $locker = $this->getLocker($id); |
|
174 | ||
175 | $redis = $this->getRedisClient(); |
|
176 | ||
177 | $locker->destroy(); |
|
178 | ||
179 | self::assertFalse($redis->exists($id)); |
|
180 | } |
|
181 | ||
182 | protected function setUp() |
|
183 | { |