@@ -55,10 +55,15 @@ public function testAppendCasMismatch()
5555        $ id$ this uniqueId ();
5656
5757        $ res$ collectionupsert ($ id"foo " , UpsertOptions::build ()->transcoder (RawBinaryTranscoder::getInstance ()));
58-         $ casstring )((int )$ rescas () + 1 );
58+ 
59+         // Replaces the last hex digit of the CAS to ensure CAS mismatch without risk of overflow 
60+         $ cas$ rescas ();
61+         $ lastsubstr ($ cas1 );
62+         $ newLast$ last'0 '  ? '1 '  : '0 ' ;
63+         $ invalidCassubstr_replace ($ cas$ newLast1 );
5964
6065        $ this expectException (CasMismatchException::class);
61-         $ collectionbinary ()->append ($ id"bar " , AppendOptions::build ()->cas ($ cas 
66+         $ collectionbinary ()->append ($ id"bar " , AppendOptions::build ()->cas ($ invalidCas 
6267    }
6368
6469    public  function  testPrependAddsBytesToTheBeginningOfTheDocument ()
@@ -85,10 +90,15 @@ public function testPrependCasMismatch()
8590        $ id$ this uniqueId ();
8691
8792        $ res$ collectionupsert ($ id"foo " , UpsertOptions::build ()->transcoder (RawBinaryTranscoder::getInstance ()));
88-         $ casstring )((int )((int )$ rescas () + 1 ));
93+ 
94+         // Replaces the last hex digit of the CAS to ensure CAS mismatch without risk of overflow 
95+         $ cas$ rescas ();
96+         $ lastsubstr ($ cas1 );
97+         $ newLast$ last'0 '  ? '1 '  : '0 ' ;
98+         $ invalidCassubstr_replace ($ cas$ newLast1 );
8999
90100        $ this expectException (CasMismatchException::class);
91-         $ collectionbinary ()->prepend ($ id"bar " , PrependOptions::build ()->cas ($ cas 
101+         $ collectionbinary ()->prepend ($ id"bar " , PrependOptions::build ()->cas ($ invalidCas 
92102    }
93103
94104    public  function  testAppendThrowsExceptionIfDocumentDoesNotExist ()
0 commit comments