From acf30ede95f4b8986787f81edcf025a84237b7c5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 29 Apr 2015 16:34:36 +0200 Subject: add compare and swap to memcache --- tests/lib/memcache/cache.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/lib/memcache') diff --git a/tests/lib/memcache/cache.php b/tests/lib/memcache/cache.php index 80ad182b6bf..9d977cf0247 100644 --- a/tests/lib/memcache/cache.php +++ b/tests/lib/memcache/cache.php @@ -91,6 +91,18 @@ abstract class Cache extends \Test_Cache { $this->assertEquals('bar', $this->instance->get('foo')); } + public function testCasNotChanged() { + $this->instance->set('foo', 'bar'); + $this->assertTrue($this->instance->cas('foo', 'bar', 'asd')); + $this->assertEquals('asd', $this->instance->get('foo')); + } + + public function testCasChanged() { + $this->instance->set('foo', 'bar1'); + $this->assertFalse($this->instance->cas('foo', 'bar', 'asd')); + $this->assertEquals('bar1', $this->instance->get('foo')); + } + protected function tearDown() { if ($this->instance) { -- cgit v1.2.3