APCuTest.php 875 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\Memcache;
  9. class APCuTest extends Cache {
  10. protected function setUp() {
  11. parent::setUp();
  12. if(!\OC\Memcache\APCu::isAvailable()) {
  13. $this->markTestSkipped('The APCu extension is not available.');
  14. return;
  15. }
  16. $this->instance=new \OC\Memcache\APCu($this->getUniqueID());
  17. }
  18. public function testCasIntChanged() {
  19. $this->instance->set('foo', 1);
  20. $this->assertTrue($this->instance->cas('foo', 1, 2));
  21. $this->assertEquals(2, $this->instance->get('foo'));
  22. }
  23. public function testCasIntNotChanged() {
  24. $this->instance->set('foo', 1);
  25. $this->assertFalse($this->instance->cas('foo', 2, 3));
  26. $this->assertEquals(1, $this->instance->get('foo'));
  27. }
  28. }