@@ 114-125 (lines=12) @@ | ||
111 | /** |
|
112 | * @test |
|
113 | */ |
|
114 | public function shouldConnectAndAcquireALock() |
|
115 | { |
|
116 | $subject = uniqid(); |
|
117 | ||
118 | $locker = $this->getLocker($subject); |
|
119 | ||
120 | $redis = $this->getRedisClient(); |
|
121 | ||
122 | self::assertTrue($redis->exists($subject)); |
|
123 | ||
124 | self::assertTrue($locker->acquire()); |
|
125 | } |
|
126 | ||
127 | /** |
|
128 | * @test |
|
@@ 144-157 (lines=14) @@ | ||
141 | /** |
|
142 | * @test |
|
143 | */ |
|
144 | public function shouldConnectAndDestroyALock() |
|
145 | { |
|
146 | $subject = uniqid(); |
|
147 | ||
148 | $locker = $this->getLocker($subject); |
|
149 | ||
150 | $redis = $this->getRedisClient(); |
|
151 | ||
152 | $redis->set($subject, 'testvalue'); |
|
153 | ||
154 | $locker->destroy(); |
|
155 | ||
156 | self::assertFalse($redis->exists($subject)); |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * @test |
|
@@ 162-173 (lines=12) @@ | ||
159 | /** |
|
160 | * @test |
|
161 | */ |
|
162 | public function shouldConnectAndDestroyANotExistingLock() |
|
163 | { |
|
164 | $subject = uniqid(); |
|
165 | ||
166 | $locker = $this->getLocker($subject); |
|
167 | ||
168 | $redis = $this->getRedisClient(); |
|
169 | ||
170 | $locker->destroy(); |
|
171 | ||
172 | self::assertFalse($redis->exists($subject)); |
|
173 | } |
|
174 | ||
175 | /** |
|
176 | * @test |