aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-08-21 17:19:04 +0200
committerGitHub <noreply@github.com>2024-08-21 17:19:04 +0200
commitc3ad469750b195f91a8c7d1a05f4d696e45f6182 (patch)
treeb64d0d1186c888348bc777729939497987fda65c /tests
parent6214e3ad766def2602750ec03c62f752712c0834 (diff)
parent20dbb6c7e8fe92445f9d665bae1b474fc7ee38a2 (diff)
downloadnextcloud-server-c3ad469750b195f91a8c7d1a05f4d696e45f6182.tar.gz
nextcloud-server-c3ad469750b195f91a8c7d1a05f4d696e45f6182.zip
Merge pull request #47259 from nextcloud/memcache-ncad
feat: add negative compare-and-delete to imemcache
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Memcache/Cache.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/Memcache/Cache.php b/tests/lib/Memcache/Cache.php
index efdaffc94eb..4749e223fd5 100644
--- a/tests/lib/Memcache/Cache.php
+++ b/tests/lib/Memcache/Cache.php
@@ -109,6 +109,10 @@ abstract class Cache extends \Test\Cache\TestCache {
$this->assertEquals('bar1', $this->instance->get('foo'));
}
+ public function testCasNotSet() {
+ $this->assertFalse($this->instance->cas('foo', 'bar', 'asd'));
+ }
+
public function testCadNotChanged() {
$this->instance->set('foo', 'bar');
$this->assertTrue($this->instance->cad('foo', 'bar'));
@@ -121,6 +125,25 @@ abstract class Cache extends \Test\Cache\TestCache {
$this->assertTrue($this->instance->hasKey('foo'));
}
+ public function testCadNotSet() {
+ $this->assertFalse($this->instance->cad('foo', 'bar'));
+ }
+
+ public function testNcadNotChanged() {
+ $this->instance->set('foo', 'bar');
+ $this->assertFalse($this->instance->ncad('foo', 'bar'));
+ $this->assertTrue($this->instance->hasKey('foo'));
+ }
+
+ public function testNcadChanged() {
+ $this->instance->set('foo', 'bar1');
+ $this->assertTrue($this->instance->ncad('foo', 'bar'));
+ $this->assertFalse($this->instance->hasKey('foo'));
+ }
+
+ public function testNcadNotSet() {
+ $this->assertFalse($this->instance->ncad('foo', 'bar'));
+ }
protected function tearDown(): void {
if ($this->instance) {