aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php7
-rw-r--r--tests/lib/Preview/BackgroundCleanupJobTest.php10
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index 7e7140971e4..7d07bffc46b 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -25,6 +25,7 @@ namespace Test\AppFramework\Middleware\PublicShare;
use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationException;
use OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware;
+use OC\Security\Bruteforce\Throttler;
use OCP\AppFramework\AuthPublicShareController;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\NotFoundResponse;
@@ -44,6 +45,8 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
private $session;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ private $throttler;
/** @var PublicShareMiddleware */
private $middleware;
@@ -55,11 +58,13 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->request = $this->createMock(IRequest::class);
$this->session = $this->createMock(ISession::class);
$this->config = $this->createMock(IConfig::class);
+ $this->throttler = $this->createMock(Throttler::class);
$this->middleware = new PublicShareMiddleware(
$this->request,
$this->session,
- $this->config
+ $this->config,
+ $this->throttler
);
}
diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php
index cd9f6ef0399..c1c225bd179 100644
--- a/tests/lib/Preview/BackgroundCleanupJobTest.php
+++ b/tests/lib/Preview/BackgroundCleanupJobTest.php
@@ -25,6 +25,7 @@ namespace Test\Preview;
use OC\Preview\BackgroundCleanupJob;
use OC\Preview\Storage\Root;
use OC\PreviewManager;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
@@ -62,6 +63,8 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
/** @var IMimeTypeLoader */
private $mimeTypeLoader;
+ private ITimeFactory $timeFactory;
+
protected function setUp(): void {
parent::setUp();
@@ -83,6 +86,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$this->previewManager = \OC::$server->getPreviewManager();
$this->rootFolder = \OC::$server->getRootFolder();
$this->mimeTypeLoader = \OC::$server->getMimeTypeLoader();
+ $this->timeFactory = \OCP\Server::get(ITimeFactory::class);
}
protected function tearDown(): void {
@@ -142,7 +146,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$root = $this->getRoot();
$this->assertSame(11, $this->countPreviews($root, $fileIds));
- $job = new BackgroundCleanupJob($this->connection, $root, $this->mimeTypeLoader, true);
+ $job = new BackgroundCleanupJob($this->timeFactory, $this->connection, $root, $this->mimeTypeLoader, true);
$job->run([]);
foreach ($files as $file) {
@@ -166,7 +170,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$root = $this->getRoot();
$this->assertSame(11, $this->countPreviews($root, $fileIds));
- $job = new BackgroundCleanupJob($this->connection, $root, $this->mimeTypeLoader, false);
+ $job = new BackgroundCleanupJob($this->timeFactory, $this->connection, $root, $this->mimeTypeLoader, false);
$job->run([]);
foreach ($files as $file) {
@@ -196,7 +200,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$appdata = \OC::$server->getAppDataDir('preview');
$this->assertSame(2, count($appdata->getDirectoryListing()));
- $job = new BackgroundCleanupJob($this->connection, $this->getRoot(), $this->mimeTypeLoader, true);
+ $job = new BackgroundCleanupJob($this->timeFactory, $this->connection, $this->getRoot(), $this->mimeTypeLoader, true);
$job->run([]);
$appdata = \OC::$server->getAppDataDir('preview');