Description
When deleting a document with an invalid CAS option passed in, the document shouldn't be deleted in v4.1.5; instead, it should throw out an exception.
Code to reproduce:
$options = new Couchbase\ClusterOptions(); |
$options->credentials('username', 'password'); |
$cluster = new Couchbase\Cluster('couchbase://couchbase7.1', $options); |
|
$collection = $cluster->bucket('test')->defaultCollection(); |
|
$key = 'key'; |
$collection->upsert($key, [$key => $key]);
|
$doc = $collection->get($key);
|
// The output is:
|
// Array
|
// (
|
// [key] => key
|
// )
|
echo print_r($doc->content(), true), PHP_EOL; |
echo $doc->cas(), PHP_EOL;
|
|
// An invalid cas value is used here.
|
$options = Couchbase\RemoveOptions::build()->cas($doc->cas() . '-invalid'); |
$collection->remove($key, $options);
|
// The output should still be:
|
// Array
|
// (
|
// [key] => key
|
// )
|
try { |
print_r($collection->get($key)->content());
|
} catch (Couchbase\Exception\DocumentNotFoundException $e) { |
echo "This shouldn't be printed out.", PHP_EOL; |
}
|