| @@ 54-68 (lines=15) @@ | ||
| 51 | * |
|
| 52 | * @return void |
|
| 53 | */ |
|
| 54 | public function addEmptyCollection() |
|
| 55 | { |
|
| 56 | $this->assertTrue($this->registry->add($this->getProcess('testId'))); |
|
| 57 | ||
| 58 | $this->assertSame(1, $this->collection->count()); |
|
| 59 | $result = $this->collection->findOne(); |
|
| 60 | ||
| 61 | $expected = [ |
|
| 62 | '_id' => 'testId', |
|
| 63 | 'hosts' => [HOSTNAME => [getmypid() => ProcessRegistry::MONGO_INT32_MAX]], |
|
| 64 | 'version' => $result['version'], |
|
| 65 | ]; |
|
| 66 | ||
| 67 | $this->assertSame($expected, $result); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @test |
|
| @@ 418-429 (lines=12) @@ | ||
| 415 | * |
|
| 416 | * @return void |
|
| 417 | */ |
|
| 418 | public function addUnderflowMinsBeforeExpire() |
|
| 419 | { |
|
| 420 | $this->assertTrue($this->registry->add($this->getProcess('testId', ~PHP_INT_MAX))); |
|
| 421 | ||
| 422 | $this->assertSame(1, $this->collection->count()); |
|
| 423 | $result = $this->collection->findOne(); |
|
| 424 | ||
| 425 | $this->assertSame( |
|
| 426 | ['_id' => 'testId', 'hosts' => [HOSTNAME => [getmypid() => 0]], 'version' => $result['version']], |
|
| 427 | $result |
|
| 428 | ); |
|
| 429 | } |
|
| 430 | ||
| 431 | /** |
|
| 432 | * @test |
|