diff options
author | Robin Appelman <robin@icewind.nl> | 2024-08-21 17:19:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 17:19:04 +0200 |
commit | c3ad469750b195f91a8c7d1a05f4d696e45f6182 (patch) | |
tree | b64d0d1186c888348bc777729939497987fda65c /tests | |
parent | 6214e3ad766def2602750ec03c62f752712c0834 (diff) | |
parent | 20dbb6c7e8fe92445f9d665bae1b474fc7ee38a2 (diff) | |
download | nextcloud-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.php | 23 |
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) { |