malkusch\lock\util\DoubleCheckedLockingTest::testCodeNotExecuted PHP Method

testCodeNotExecuted() public method

Tests that the code is not executed if the first or second check fails.
public testCodeNotExecuted ( callable $check )
$check callable The check.
    public function testCodeNotExecuted(callable $check)
    {
        $this->mutex->expects($this->any())->method("synchronized")->willReturnCallback(function (callable $block) {
            return call_user_func($block);
        });
        $this->checkedLocking->setCheck($check);
        $this->checkedLocking->then(function () {
            $this->fail();
        });
    }