@@ 468-486 (lines=19) @@ | ||
465 | * |
|
466 | * @return void |
|
467 | */ |
|
468 | public function removeWithoutExistingProcess() |
|
469 | { |
|
470 | $initialVersion = new ObjectID(); |
|
471 | $initalTask = [ |
|
472 | '_id' => 'testId', |
|
473 | 'hosts' => [HOSTNAME => [getmypid() => time() + 60]], |
|
474 | 'version' => $initialVersion, |
|
475 | ]; |
|
476 | ||
477 | $this->collection->insertOne($initalTask); |
|
478 | ||
479 | $this->registry->remove($this->getProcess('testId')); |
|
480 | ||
481 | $this->assertSame(1, $this->collection->count()); |
|
482 | $result = $this->collection->findOne(); |
|
483 | ||
484 | $this->assertSame(['_id' => 'testId', 'hosts' => [HOSTNAME => []], 'version' => $result['version']], $result); |
|
485 | $this->assertNotSame((string)$initialVersion, (string)$result['version']); |
|
486 | } |
|
487 | ||
488 | /** |
|
489 | * @test |
|
@@ 566-587 (lines=22) @@ | ||
563 | * |
|
564 | * @return void |
|
565 | */ |
|
566 | public function resetUnderflowMinsBeforeExpire() |
|
567 | { |
|
568 | $initialVersion = new ObjectID(); |
|
569 | $initalTask = [ |
|
570 | '_id' => 'testId', |
|
571 | 'hosts' => [HOSTNAME => [getmypid() => time() + 60]], |
|
572 | 'version' => $initialVersion, |
|
573 | ]; |
|
574 | ||
575 | $this->collection->insertOne($initalTask); |
|
576 | ||
577 | $this->registry->reset($this->getProcess('testId', ~PHP_INT_MAX)); |
|
578 | ||
579 | $this->assertSame(1, $this->collection->count()); |
|
580 | $result = $this->collection->findOne(); |
|
581 | ||
582 | $this->assertSame( |
|
583 | ['_id' => 'testId', 'hosts' => [HOSTNAME => [getmypid() => 0]], 'version' => $result['version']], |
|
584 | $result |
|
585 | ); |
|
586 | $this->assertNotSame((string)$initialVersion, (string)$result['version']); |
|
587 | } |
|
588 | ||
589 | /** |
|
590 | * @test |