Skip to content

Commit

Permalink
use correct clock interface for 25
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Oct 24, 2023
1 parent 2bea43b commit a3af20f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/files_external/lib/Config/ConfigAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage;
use OCP\Files\Storage\IStorageFactory;
use OCP\Files\StorageNotAvailableException;
use OCP\IUser;
use Psr\Clock\ClockInterface;

/**
* Make the old files_external config work with the new public mount config api
Expand All @@ -50,7 +50,7 @@ class ConfigAdapter implements IMountProvider {
public function __construct(
private UserStoragesService $userStoragesService,
private UserGlobalStoragesService $userGlobalStoragesService,
private ClockInterface $clock,
private ITimeFactory $clock,
) {}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Storage/Wrapper/KnownMtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace OC\Files\Storage\Wrapper;

use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Cache\CappedMemoryCache;
use OCP\Files\Storage\IStorage;
use Psr\Clock\ClockInterface;

/**
* Wrapper that overwrites the mtime return by stat/getMetaData if the returned value
Expand All @@ -14,7 +14,7 @@
*/
class KnownMtime extends Wrapper {
private CappedMemoryCache $knowMtimes;
private ClockInterface $clock;
private ITimeFactory $clock;

public function __construct($arguments) {
parent::__construct($arguments);
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\KnownMtime;
use OCP\AppFramework\Utility\ITimeFactory;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Clock\ClockInterface;
use Test\Files\Storage\Storage;

/**
Expand All @@ -21,15 +21,15 @@ class KnownMtimeTest extends Storage {
/** @var Temporary */
private $sourceStorage;

/** @var ClockInterface|MockObject */
/** @var ITimeFactory|MockObject */
private $clock;
private int $fakeTime = 0;

protected function setUp(): void {
parent::setUp();
$this->fakeTime = 0;
$this->sourceStorage = new Temporary([]);
$this->clock = $this->createMock(ClockInterface::class);
$this->clock = $this->createMock(ITimeFactory::class);
$this->clock->method('now')->willReturnCallback(function () {
if ($this->fakeTime) {
return new \DateTimeImmutable("@{$this->fakeTime}");
Expand Down

0 comments on commit a3af20f

Please sign in to comment.