diff options
Diffstat (limited to 'tests/lib/Share20/ShareByMailProviderTest.php')
-rw-r--r-- | tests/lib/Share20/ShareByMailProviderTest.php | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/tests/lib/Share20/ShareByMailProviderTest.php b/tests/lib/Share20/ShareByMailProviderTest.php index 0cdd13fe17c..de4dc1a820c 100644 --- a/tests/lib/Share20/ShareByMailProviderTest.php +++ b/tests/lib/Share20/ShareByMailProviderTest.php @@ -3,24 +3,8 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2022 Richard Steinmetz <richard@steinmetz.cloud> - * - * @author Richard Steinmetz <richard@steinmetz.cloud> - * - * @license AGPL-3.0-or-later - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace Test\Share20; @@ -40,6 +24,7 @@ use OCP\IUserManager; use OCP\Mail\IMailer; use OCP\Security\IHasher; use OCP\Security\ISecureRandom; +use OCP\Server; use OCP\Share\IShare; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; @@ -101,7 +86,7 @@ class ShareByMailProviderTest extends TestCase { private $settingsManager; protected function setUp(): void { - $this->dbConn = \OC::$server->getDatabaseConnection(); + $this->dbConn = Server::get(IDBConnection::class); $this->userManager = $this->createMock(IUserManager::class); $this->rootFolder = $this->createMock(IRootFolder::class); $this->mailer = $this->createMock(IMailer::class); @@ -141,7 +126,7 @@ class ShareByMailProviderTest extends TestCase { protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->execute(); - $this->dbConn->getQueryBuilder()->delete('filecache')->execute(); + $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->execute(); $this->dbConn->getQueryBuilder()->delete('storages')->execute(); } @@ -195,7 +180,7 @@ class ShareByMailProviderTest extends TestCase { $qb->setValue('token', $qb->expr()->literal($token)); } if ($expiration) { - $qb->setValue('expiration', $qb->createNamedParameter($expiration, IQueryBuilder::PARAM_DATE)); + $qb->setValue('expiration', $qb->createNamedParameter($expiration, IQueryBuilder::PARAM_DATETIME_MUTABLE)); } if ($parent) { $qb->setValue('parent', $qb->expr()->literal($parent)); @@ -205,7 +190,7 @@ class ShareByMailProviderTest extends TestCase { return $qb->getLastInsertId(); } - public function testGetSharesByWithResharesAndNoNode() { + public function testGetSharesByWithResharesAndNoNode(): void { $this->addShareToDB( IShare::TYPE_EMAIL, 'external.one@domain.tld', @@ -252,7 +237,7 @@ class ShareByMailProviderTest extends TestCase { $this->assertEquals('external.one@domain.tld', $actual[0]->getSharedWith()); } - public function testGetSharesByWithResharesAndNode() { + public function testGetSharesByWithResharesAndNode(): void { $this->addShareToDB( IShare::TYPE_EMAIL, 'external.one@domain.tld', |