Skip to content

Commit 7031108

Browse files
committed
Update tests according to recent 3.1.0 changes
Change-Id: I7d6a82e3986e2d2c5c284f635031df5eb453610b Reviewed-on: http://review.couchbase.org/c/php-couchbase/+/147759 Tested-by: Build Bot <[email protected]> Reviewed-by: Sergey Avseyev <[email protected]>
1 parent 76c01e7 commit 7031108

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

exception.c

+4
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ void pcbc_create_lcb_exception(zval *return_value, long code, zend_string *conte
368368
exc_ce = pcbc_query_exception_ce;
369369
break;
370370

371+
case LCB_ERR_CAS_MISMATCH:
372+
exc_ce = pcbc_cas_mismatch_exception_ce;
373+
break;
374+
371375
default:
372376
exc_ce = pcbc_base_exception_ce;
373377
break;

tests/BucketTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function testGoodCas($c) {
9292
$res = $c->upsert($key, ['name' => 'bob']);
9393
$this->assertNotNull($res->cas());
9494
$cas1 = $res->cas();
95-
var_dump($res->cas());
9695

9796
$options = new ReplaceOptions();
9897
$options->cas($cas1);
@@ -274,7 +273,7 @@ function testCas($c) {
274273
$this->wrapException(function() use($c, $key, $old_cas) {
275274
$options = (new \Couchbase\ReplaceOptions())->cas($old_cas);
276275
$c->replace($key, 'ferret', $options);
277-
}, '\Couchbase\CasMismatchException', COUCHBASE_KEYALREADYEXISTS);
276+
}, '\Couchbase\CasMismatchException', COUCHBASE_ERR_CAS_MISMATCH);
278277
}
279278

280279
/**
@@ -527,7 +526,7 @@ function testMutateInFulldoc($c) {
527526
new \Couchbase\MutateUpsertSpec('created_at', time(), true, true),
528527
new \Couchbase\MutateReplaceSpec('', ["duplicate" => "yes"])
529528
], $options);
530-
}, '\Couchbase\KeyExistsException');
529+
}, '\Couchbase\CasMismatchException');
531530

532531
$options = (new \Couchbase\MutateInOptions())->storeSemantics(\Couchbase\StoreSemantics::REPLACE);
533532
$result = $c->mutateIn($key, [
@@ -583,7 +582,7 @@ function testMutateIn($c) {
583582
$result = $c->mutateIn($key, [
584583
new \Couchbase\MutateUpsertSpec('newDict', 'withWrongCAS'),
585584
], $options);
586-
}, '\Couchbase\KeyExistsException');
585+
}, '\Couchbase\CasMismatchException');
587586

588587
# once again with correct CAS
589588
$options = (new \Couchbase\MutateInOptions())->cas($cas);

0 commit comments

Comments
 (0)