1
0

APCuTest.php 926 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. /**
  10. * @group Memcache
  11. * @group APCu
  12. */
  13. class APCuTest extends Cache {
  14. protected function setUp(): void {
  15. parent::setUp();
  16. if (!\OC\Memcache\APCu::isAvailable()) {
  17. $this->markTestSkipped('The APCu extension is not available.');
  18. return;
  19. }
  20. $this->instance = new \OC\Memcache\APCu($this->getUniqueID());
  21. }
  22. public function testCasIntChanged() {
  23. $this->instance->set('foo', 1);
  24. $this->assertTrue($this->instance->cas('foo', 1, 2));
  25. $this->assertEquals(2, $this->instance->get('foo'));
  26. }
  27. public function testCasIntNotChanged() {
  28. $this->instance->set('foo', 1);
  29. $this->assertFalse($this->instance->cas('foo', 2, 3));
  30. $this->assertEquals(1, $this->instance->get('foo'));
  31. }
  32. }