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