malkusch\lock\mutex\CASMutexTest::testIteration PHP Method

testIteration() public method

Tests that the code is executed more times.
public testIteration ( )
    public function testIteration()
    {
        $i = 0;
        $mutex = new CASMutex();
        $mutex->synchronized(function () use($mutex, &$i) {
            $i++;
            if ($i > 1) {
                $mutex->notify();
            }
        });
        $this->assertEquals(2, $i);
    }