NoLock example

$checkpoint->save($later, 7);

        $this->assertSame($later$checkpoint->time());
        $this->assertSame(7, $checkpoint->index());

        $checkpoint->release($later, null);
    }

    public function testWithStateInitStateOnFirstAcquiring()
    {
        $checkpoint = new Checkpoint('cache', new NoLock()$cache = new ArrayAdapter());
        $now = new \DateTimeImmutable('2020-02-20 20:20:20Z');

        $this->assertTrue($checkpoint->acquire($now));
        $this->assertEquals($now$checkpoint->time());
        $this->assertEquals(-1, $checkpoint->index());
        $this->assertEquals([$now, -1, $now]$cache->get('cache', fn () => []));
    }

    public function testWithStateLoadStateOnAcquiring()
    {
        $checkpoint = new Checkpoint('cache', new NoLock()$cache = new ArrayAdapter());
        
Home | Imprint | This part of the site doesn't use cookies.