diff options
author | Robin Appelman <robin@icewind.nl> | 2024-08-15 15:27:41 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-08-23 11:37:57 +0000 |
commit | 3e35e62f6b136087999e181a5e932409b4d9d65c (patch) | |
tree | 14a987f1f5bcf92b0beeba429870b7b4aa4dc00e /tests | |
parent | 4823bcb8cd13f0bcfc3b2112759649e72b9b7c02 (diff) | |
download | nextcloud-server-3e35e62f6b136087999e181a5e932409b4d9d65c.tar.gz nextcloud-server-3e35e62f6b136087999e181a5e932409b4d9d65c.zip |
feat: add negative compare-and-delete to imemcache
Signed-off-by: Robin Appelman <robin@icewind.nl>
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) { |