diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-07-16 16:06:00 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-07-16 16:06:00 +0200 |
commit | 504089940de88220a425db21e8e133582fe15c30 (patch) | |
tree | 7a2eec110b5e967981f1670f84df23e3f0f85845 /tests/lib/memcache | |
parent | 8ad148feaf975481815b3f2413fc1fa34b3e8be7 (diff) | |
download | nextcloud-server-504089940de88220a425db21e8e133582fe15c30.tar.gz nextcloud-server-504089940de88220a425db21e8e133582fe15c30.zip |
mamcache: implement the ArrayAccess interface
Diffstat (limited to 'tests/lib/memcache')
-rw-r--r-- | tests/lib/memcache/cache.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/memcache/cache.php b/tests/lib/memcache/cache.php index 2c1dbc9d2f7..e2643b9fcd9 100644 --- a/tests/lib/memcache/cache.php +++ b/tests/lib/memcache/cache.php @@ -28,6 +28,28 @@ class Cache extends \Test_Cache { $this->assertFalse($this->instance->hasKey('foo')); } + public function testArrayAccessSet() { + $this->instance['foo'] = 'bar'; + $this->assertEquals('bar', $this->instance->get('foo')); + } + + public function testArrayAccessGet() { + $this->instance->set('foo', 'bar'); + $this->assertEquals('bar', $this->instance['foo']); + } + + public function testArrayAccessExists() { + $this->assertFalse(isset($this->instance['foo'])); + $this->instance->set('foo', 'bar'); + $this->assertTrue(isset($this->instance['foo'])); + } + + public function testArrayAccessUnset() { + $this->instance->set('foo', 'bar'); + unset($this->instance['foo']); + $this->assertFalse($this->instance->hasKey('foo')); + } + public function tearDown() { if ($this->instance) { $this->instance->clear(); |