From 70e2217d1c23dbe7062c188091c0d9f10a5bd84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 14 Nov 2022 16:14:35 +0100 Subject: [PATCH 1/5] Fix dynamic properties and other problems in tests for PHP 8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/DB/MigrationsTest.php | 4 +++- tests/lib/Encryption/Keys/StorageTest.php | 9 +++++---- .../VerificationTokenTest.php | 11 ++++++---- tests/lib/Settings/ManagerTest.php | 20 ++++++++++--------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php index 3d115f25adfd5..b7d49b565ac1e 100644 --- a/tests/lib/DB/MigrationsTest.php +++ b/tests/lib/DB/MigrationsTest.php @@ -31,7 +31,6 @@ * @package Test\DB */ class MigrationsTest extends \Test\TestCase { - /** @var MigrationService | \PHPUnit\Framework\MockObject\MockObject */ private $migrationService; /** @var \PHPUnit\Framework\MockObject\MockObject | IDBConnection $db */ @@ -247,6 +246,9 @@ public function testEnsureOracleConstraintsValid() { ->willReturn(\str_repeat('a', 30)); $primaryKey = $this->createMock(Index::class); + $primaryKey->expects($this->once()) + ->method('getName') + ->willReturn(\str_repeat('a', 30)); $table->expects($this->once()) ->method('getColumns') diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index bb7bbbcd7c1f0..5301453c19154 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -31,22 +31,23 @@ use Test\TestCase; class StorageTest extends TestCase { - /** @var Storage */ protected $storage; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $util; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $view; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $config; /** @var MockObject|ICrypto */ protected $crypto; + private array $mkdirStack = []; + protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Security/VerificationToken/VerificationTokenTest.php b/tests/lib/Security/VerificationToken/VerificationTokenTest.php index 4d90e304ab717..3dd8923362cf7 100644 --- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php +++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php @@ -35,18 +35,21 @@ use OCP\Security\ISecureRandom; use OCP\Security\VerificationToken\InvalidTokenException; use Test\TestCase; +use PHPUnit\Framework\MockObject\MockObject; class VerificationTokenTest extends TestCase { /** @var VerificationToken */ protected $token; - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IConfig|MockObject */ protected $config; - /** @var ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ISecureRandom|MockObject */ protected $secureRandom; - /** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ICrypto|MockObject */ protected $crypto; - /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ITimeFactory|MockObject */ protected $timeFactory; + /** @var IJobList|MockObject */ + protected $jobList protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 29ae33c3c93be..cc13479b1d0c1 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -36,24 +36,26 @@ use OCP\Settings\ISubAdminSettings; use Psr\Log\LoggerInterface; use Test\TestCase; +use PHPUnit\Framework\MockObject\MockObject; class ManagerTest extends TestCase { - - /** @var Manager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Manager|MockObject */ private $manager; - /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; - /** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IDBConnection|MockObject */ private $l10n; - /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IFactory|MockObject */ private $l10nFactory; - /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IURLGenerator|MockObject */ private $url; - /** @var IServerContainer|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IServerContainer|MockObject */ private $container; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var AuthorizedGroupMapper|MockObject */ + private $mapper; + /** @var IGroupManager|MockObject */ private $groupManager; - /** @var ISubAdmin|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ISubAdmin|MockObject */ private $subAdmin; protected function setUp(): void { From c79a6b3f62948075f7ce67a0294b0410fd61af3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 14 Nov 2022 17:06:28 +0100 Subject: [PATCH 2/5] Fix errors from PHP 8.2 testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/dav/lib/RootCollection.php | 1 - .../unit/BackgroundJob/CleanupInvitationTokenJobTest.php | 4 +--- .../BackgroundJob/PruneOutdatedSyncTokensJobTest.php | 3 ++- .../tests/unit/CalDAV/Reminder/ReminderServiceTest.php | 5 +++-- apps/dav/tests/unit/CardDAV/Activity/BackendTest.php | 4 +++- apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php | 9 ++++----- .../unit/Controller/InvitationResponseControllerTest.php | 4 +--- apps/federatedfilesharing/tests/Settings/AdminTest.php | 2 ++ apps/files_sharing/tests/ShareTest.php | 8 +++++--- .../tests/Controller/GroupsControllerTest.php | 3 ++- apps/settings/tests/Mailer/NewUserMailHelperTest.php | 8 +++++--- apps/theming/tests/Settings/PersonalTest.php | 3 ++- apps/theming/tests/Themes/DyslexiaFontTest.php | 3 ++- lib/private/User/Session.php | 4 +--- tests/lib/Share20/ShareTest.php | 6 ++++-- 15 files changed, 37 insertions(+), 30 deletions(-) diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index 29ab65d46a923..bacb550b4154e 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -118,7 +118,6 @@ public function __construct() { $roomCalendarRoot->disableListing = $disableListing; $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config, $logger); - $publicCalendarRoot->disableListing = $disableListing; $systemTagCollection = new SystemTag\SystemTagsByIdCollection( \OC::$server->getSystemTagManager(), diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php index fd27b4d2776ba..d3b7ca925812d 100644 --- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php @@ -32,12 +32,10 @@ use OCA\DAV\BackgroundJob\CleanupInvitationTokenJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; use Test\TestCase; class CleanupInvitationTokenJobTest extends TestCase { - /** @var IDBConnection | \PHPUnit\Framework\MockObject\MockObject */ private $dbConnection; @@ -78,7 +76,7 @@ public function testRun() { [1337, \PDO::PARAM_STR, null, 'namedParameter1337'] ]); - $function = $this->createMock(IQueryFunction::class); + $function = 'function1337'; $expr->expects($this->once()) ->method('lt') ->with('expiration', 'namedParameter1337') diff --git a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php index 991caafd59705..1de56b37d800c 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -34,13 +34,14 @@ use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CardDAV\CardDavBackend; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\DB\Exception; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; class PruneOutdatedSyncTokensJobTest extends TestCase { + /** @var ITimeFactory | MockObject */ + private $timeFactory; /** @var CalDavBackend | MockObject */ private $calDavBackend; diff --git a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php index 79d9376650b0e..e2b5390f875b6 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php @@ -40,13 +40,11 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; -use OCP\IUserSession; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; class ReminderServiceTest extends TestCase { - /** @var Backend|MockObject */ private $backend; @@ -74,6 +72,9 @@ class ReminderServiceTest extends TestCase { /** @var MockObject|LoggerInterface */ private $logger; + /** @var MockObject|Principal */ + private $principalConnector; + public const CALENDAR_DATA = <<activityManager = $this->createMock(IManager::class); diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 7cd31e3b8dd6c..2614f5416136b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -54,7 +54,6 @@ use Test\TestCase; class PrincipalTest extends TestCase { - /** @var IUserManager | MockObject */ private $userManager; @@ -658,12 +657,12 @@ public function testSearchPrincipalWithEnumerationDisabledDisplayname(): void { $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar'); $user3 = $this->createMock(IUser::class); $user3->method('getUID')->willReturn('user3'); - $user2->method('getDisplayName')->willReturn('User 22'); - $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar123'); + $user3->method('getDisplayName')->willReturn('User 22'); + $user3->method('getSystemEMailAddress')->willReturn('user2@foo.bar123'); $user4 = $this->createMock(IUser::class); $user4->method('getUID')->willReturn('user4'); - $user2->method('getDisplayName')->willReturn('User 222'); - $user2->method('getSystemEMailAddress')->willReturn('user2@foo.bar456'); + $user4->method('getDisplayName')->willReturn('User 222'); + $user4->method('getSystemEMailAddress')->willReturn('user2@foo.bar456'); $this->userManager->expects($this->at(0)) ->method('searchDisplayName') diff --git a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php index 576fde2d4af28..efbad5e300817 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -37,14 +37,12 @@ use OCP\DB\IResult; use OCP\DB\QueryBuilder\IExpressionBuilder; use OCP\DB\QueryBuilder\IQueryBuilder; -use OCP\DB\QueryBuilder\IQueryFunction; use OCP\IDBConnection; use OCP\IRequest; use Sabre\VObject\ITip\Message; use Test\TestCase; class InvitationResponseControllerTest extends TestCase { - /** @var InvitationResponseController */ private $controller; @@ -478,7 +476,7 @@ private function buildQueryExpects($token, $return, $time) { ->with(\PDO::FETCH_ASSOC) ->willReturn($return); - $function = $this->createMock(IQueryFunction::class); + $function = 'functionToken'; $expr->expects($this->once()) ->method('eq') ->with('token', 'namedParameterToken') diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 04761e3541023..a9148987d387e 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -41,6 +41,8 @@ class AdminTest extends TestCase { private $federatedShareProvider; /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ private $gsConfig; + /** @var IInitialState|\PHPUnit\Framework\MockObject\MockObject */ + private $initialState; protected function setUp(): void { parent::setUp(); diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 45c7ceb61ef08..45bd5a3d707d1 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -39,6 +39,8 @@ class ShareTest extends TestCase { private static $tempStorage; + private string $subsubfolder = ''; + protected function setUp(): void { parent::setUp(); @@ -176,14 +178,14 @@ public function testShareWithGroupUniqueName() { $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; - $this->assertSame('/test.txt' ,$share->getTarget()); + $this->assertSame('/test.txt', $share->getTarget()); $this->assertSame(19, $share->getPermissions()); \OC\Files\Filesystem::rename('test.txt', 'new test.txt'); $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; - $this->assertSame('/new test.txt' ,$share->getTarget()); + $this->assertSame('/new test.txt', $share->getTarget()); $this->assertSame(19, $share->getPermissions()); $share->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE); @@ -193,7 +195,7 @@ public function testShareWithGroupUniqueName() { $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; - $this->assertSame('/new test.txt' ,$share->getTarget()); + $this->assertSame('/new test.txt', $share->getTarget()); $this->assertSame(3, $share->getPermissions()); } diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 1201099556074..5d16d58fc0a2f 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -44,7 +44,6 @@ use Psr\Log\LoggerInterface; class GroupsControllerTest extends \Test\TestCase { - /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ protected $request; /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ @@ -57,6 +56,8 @@ class GroupsControllerTest extends \Test\TestCase { protected $userSession; /** @var IAccountManager|\PHPUnit\Framework\MockObject\MockObject */ protected $accountManager; + /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ + protected $l10nFactory; /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $logger; /** @var SubAdmin|\PHPUnit\Framework\MockObject\MockObject */ diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index 2a9c1ee58ec0e..eddf6fa3811aa 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -55,6 +55,8 @@ class NewUserMailHelperTest extends TestCase { private $urlGenerator; /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */ private $l10n; + /** @var IFactory|\PHPUnit\Framework\MockObject\MockObject */ + private $l10nFactory; /** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */ private $mailer; /** @var ISecureRandom|\PHPUnit\Framework\MockObject\MockObject */ @@ -367,7 +369,7 @@ public function testGenerateTemplateWithPasswordResetToken() { Install Client: https://nextcloud.com/install/#install-clients --- +-- TestCloud This is an automatically sent email, please do not reply. EOF; @@ -601,7 +603,7 @@ public function testGenerateTemplateWithoutPasswordResetToken() { Install Client: https://nextcloud.com/install/#install-clients --- +-- TestCloud This is an automatically sent email, please do not reply. EOF; @@ -822,7 +824,7 @@ public function testGenerateTemplateWithoutUserId() { Install Client: https://nextcloud.com/install/#install-clients --- +-- TestCloud This is an automatically sent email, please do not reply. EOF; diff --git a/apps/theming/tests/Settings/PersonalTest.php b/apps/theming/tests/Settings/PersonalTest.php index f8f6052a0f851..4e9be5ef994c9 100644 --- a/apps/theming/tests/Settings/PersonalTest.php +++ b/apps/theming/tests/Settings/PersonalTest.php @@ -54,6 +54,7 @@ class PersonalTest extends TestCase { private ThemesService $themesService; private IInitialState $initialStateService; private ThemingDefaults $themingDefaults; + private Personal $admin; /** @var ITheme[] */ private $themes; @@ -144,7 +145,7 @@ private function initThemes() { $themingDefaults->expects($this->any()) ->method('getColorPrimary') ->willReturn('#0082c9'); - + $themingDefaults->expects($this->any()) ->method('getDefaultColorPrimary') ->willReturn('#0082c9'); diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php index 1a0f0adebec3d..3e92d03e4731d 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -40,10 +40,11 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; - class DyslexiaFontTest extends TestCase { /** @var ThemingDefaults|MockObject */ private $themingDefaults; + /** @var IUserSession|MockObject */ + private $userSession; /** @var IURLGenerator|MockObject */ private $urlGenerator; /** @var ImageManager|MockObject */ diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index acf95b1e27125..f9ad1f72ab85d 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -89,7 +89,6 @@ * @package OC\User */ class Session implements IUserSession, Emitter { - /** @var Manager $manager */ private $manager; @@ -448,7 +447,6 @@ public function logClientIn($user, // Try to login with this username and password if (!$this->login($user, $password)) { - // Failed, maybe the user used their email address if (!filter_var($user, FILTER_VALIDATE_EMAIL)) { return false; @@ -672,7 +670,7 @@ public function createSessionToken(IRequest $request, $uid, $loginName, $passwor // User does not exist return false; } - $name = isset($request->server['HTTP_USER_AGENT']) ? utf8_encode($request->server['HTTP_USER_AGENT']) : 'unknown browser'; + $name = isset($request->server['HTTP_USER_AGENT']) ? mb_convert_encoding($request->server['HTTP_USER_AGENT'], 'UTF-8', 'ISO-8859-1') : 'unknown browser'; try { $sessionId = $this->session->getId(); $pwd = $this->getPassword($password); diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php index 7d4dc6de2d6da..b2419e0768321 100644 --- a/tests/lib/Share20/ShareTest.php +++ b/tests/lib/Share20/ShareTest.php @@ -23,6 +23,7 @@ use OCP\Files\IRootFolder; use OCP\IUserManager; +use PHPUnit\Framework\MockObject\MockObject; /** * Class ShareTest @@ -30,9 +31,10 @@ * @package Test\Share20 */ class ShareTest extends \Test\TestCase { - - /** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IRootFolder|MockObject */ protected $rootFolder; + /** @var IUserManager|MockObject */ + protected $userManager; /** @var \OCP\Share\IShare */ protected $share; From 0f7e56b3b30d3a28fb4642b423e3c1fe77544338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 15 Nov 2022 09:25:56 +0100 Subject: [PATCH 3/5] Fix syntax in VerificationTokenTest.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/Security/VerificationToken/VerificationTokenTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Security/VerificationToken/VerificationTokenTest.php b/tests/lib/Security/VerificationToken/VerificationTokenTest.php index 3dd8923362cf7..481646f26aba2 100644 --- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php +++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php @@ -49,7 +49,7 @@ class VerificationTokenTest extends TestCase { /** @var ITimeFactory|MockObject */ protected $timeFactory; /** @var IJobList|MockObject */ - protected $jobList + protected $jobList; protected function setUp(): void { parent::setUp(); From 324126888ec32e4cb58acb70f87dba0994e602bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 15 Nov 2022 09:29:35 +0100 Subject: [PATCH 4/5] Add Union types for properties in tests/lib/Encryption/Keys/StorageTest.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/Encryption/Keys/StorageTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 5301453c19154..d1c0257cc6e87 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -34,13 +34,13 @@ class StorageTest extends TestCase { /** @var Storage */ protected $storage; - /** @var MockObject */ + /** @var MockObject|\OC\Encryption\Util */ protected $util; - /** @var MockObject */ + /** @var MockObject|View */ protected $view; - /** @var MockObject */ + /** @var MockObject|IConfig */ protected $config; /** @var MockObject|ICrypto */ From 72f4b34ad5816212fd0f8da374112edcc796b5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 15 Nov 2022 10:31:58 +0100 Subject: [PATCH 5/5] Fix tests depending on a trailing whitespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many editors remove trailing whitespaces, so avoid depending on them for tests success. Signed-off-by: Côme Chilliet --- apps/settings/tests/Mailer/NewUserMailHelperTest.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/settings/tests/Mailer/NewUserMailHelperTest.php b/apps/settings/tests/Mailer/NewUserMailHelperTest.php index eddf6fa3811aa..252dcfd805763 100644 --- a/apps/settings/tests/Mailer/NewUserMailHelperTest.php +++ b/apps/settings/tests/Mailer/NewUserMailHelperTest.php @@ -369,7 +369,9 @@ public function testGenerateTemplateWithPasswordResetToken() { Install Client: https://nextcloud.com/install/#install-clients --- +EOF; + $expectedTextBody .= "\n-- \n"; + $expectedTextBody .= <<