Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests in files_versions #28132

Merged
merged 1 commit into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ protected function setUp(): void {
$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())
Expand All @@ -86,7 +85,6 @@ protected function setUp(): void {
$this->createMock(IRequest::class),
$this->rootFolder,
$this->userSession,
$this->mimeTypeDetector,
$this->versionManager,
$this->previewManager
);
Expand Down Expand Up @@ -170,10 +168,6 @@ public function testVersionNotFound() {
->with('file')
->willReturn($sourceFile);

$this->mimeTypeDetector->method('detectPath')
->with($this->equalTo('file'))
->willReturn('myMime');

$this->versionManager->method('getVersionFile')
->willThrowException(new NotFoundException());

Expand Down
4 changes: 3 additions & 1 deletion apps/files_versions/tests/ExpirationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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
Expand Down Expand Up @@ -109,8 +110,9 @@ public function expirationData() {
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);
Expand Down