malkusch\lock\util\DoubleCheckedLockingTest::testCodeExecuted PHP Метод

testCodeExecuted() публичный Метод

Tests that the code executed if the checks are true.
public testCodeExecuted ( )
    public function testCodeExecuted()
    {
        $this->mutex->expects($this->once())->method("synchronized")->willReturnCallback(function (callable $block) {
            return call_user_func($block);
        });
        $this->checkedLocking->setCheck(function () {
            return true;
        });
        $executed = false;
        $this->checkedLocking->then(function () use(&$executed) {
            $executed = true;
        });
        $this->assertTrue($executed);
    }