MemcacheLockingProviderTest.php 750 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace Test\Lock;
  8. use OC\Memcache\ArrayCache;
  9. use OCP\AppFramework\Utility\ITimeFactory;
  10. class MemcacheLockingProviderTest extends LockingProvider {
  11. /**
  12. * @var \OCP\IMemcache
  13. */
  14. private $memcache;
  15. /**
  16. * @return \OCP\Lock\ILockingProvider
  17. */
  18. protected function getInstance() {
  19. $this->memcache = new ArrayCache();
  20. $timeProvider = \OC::$server->get(ITimeFactory::class);
  21. return new \OC\Lock\MemcacheLockingProvider($this->memcache, $timeProvider);
  22. }
  23. protected function tearDown(): void {
  24. $this->memcache->clear();
  25. parent::tearDown();
  26. }
  27. }