aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-07-23 14:32:54 +0200
committerCarl Schwan <carl@carlschwan.eu>2021-07-23 17:50:46 +0200
commit0d987dd2a069984dd71d0b35c4880e66e782a97a (patch)
treefdf74bd43e245afd388c5abbf5b604d7b486d8b9 /apps/files_versions/tests
parent229bfcbab56e2de473d2d34bb7d86b5665d4ab35 (diff)
downloadnextcloud-server-0d987dd2a069984dd71d0b35c4880e66e782a97a.tar.gz
nextcloud-server-0d987dd2a069984dd71d0b35c4880e66e782a97a.zip
Fix tests in files_versions
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_versions/tests')
-rw-r--r--apps/files_versions/tests/Controller/PreviewControllerTest.php6
-rw-r--r--apps/files_versions/tests/ExpirationTest.php4
2 files changed, 3 insertions, 7 deletions
diff --git a/apps/files_versions/tests/Controller/PreviewControllerTest.php b/apps/files_versions/tests/Controller/PreviewControllerTest.php
index 51ef45af881..64a060e3108 100644
--- a/apps/files_versions/tests/Controller/PreviewControllerTest.php
+++ b/apps/files_versions/tests/Controller/PreviewControllerTest.php
@@ -73,7 +73,6 @@ class PreviewControllerTest extends TestCase {
$user->expects($this->any())
->method('getUID')
->willReturn($this->userId);
- $this->mimeTypeDetector = $this->createMock(IMimeTypeDetector::class);
$this->previewManager = $this->createMock(IPreview::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->userSession->expects($this->any())
@@ -86,7 +85,6 @@ class PreviewControllerTest extends TestCase {
$this->createMock(IRequest::class),
$this->rootFolder,
$this->userSession,
- $this->mimeTypeDetector,
$this->versionManager,
$this->previewManager
);
@@ -170,10 +168,6 @@ class PreviewControllerTest extends TestCase {
->with('file')
->willReturn($sourceFile);
- $this->mimeTypeDetector->method('detectPath')
- ->with($this->equalTo('file'))
- ->willReturn('myMime');
-
$this->versionManager->method('getVersionFile')
->willThrowException(new NotFoundException());
diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php
index fdfba49c2e2..228d1d6830c 100644
--- a/apps/files_versions/tests/ExpirationTest.php
+++ b/apps/files_versions/tests/ExpirationTest.php
@@ -29,6 +29,7 @@ use OCA\Files_Versions\Expiration;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class ExpirationTest extends \Test\TestCase {
public const SECONDS_PER_DAY = 86400; //60*60*24
@@ -109,8 +110,9 @@ class ExpirationTest extends \Test\TestCase {
public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) {
$mockedConfig = $this->getMockedConfig($retentionObligation);
$mockedTimeFactory = $this->getMockedTimeFactory($timeNow);
+ $mockedLogger = $this->createMock(LoggerInterface::class);
- $expiration = new Expiration($mockedConfig, $mockedTimeFactory);
+ $expiration = new Expiration($mockedConfig, $mockedTimeFactory, $mockedLogger);
$actualResult = $expiration->isExpired($timestamp, $quotaExceeded);
$this->assertEquals($expectedResult, $actualResult);