$keyId =
uniqid(__METHOD__, true
);
$store1Key =
new Key($keyId);
$store1->
save($store1Key);
// set a low time out then try to wait and save, which will fail
// because the key is already set above.
$pdo->
exec('SET statement_timeout = 1'
);
$waitSaveError = null;
try { $store2->
waitAndSaveRead(new Key($keyId));
} catch (\PDOException
$waitSaveError) { } $this->
assertInstanceOf(\PDOException::
class,
$waitSaveError, 'waitAndSave should have thrown'
);
$store1->
delete($store1Key);
$this->
assertFalse($store1->
exists($store1Key));
$store2Key =
new Key($keyId);
// since the lock is going to be acquired in read mode and is not exclusive
// this won't every throw a LockConflictedException as it would from
// waitAndSave, but it will hang indefinitely as it waits for postgres