diff options
15 files changed, 37 insertions, 30 deletions
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index 29ab65d46a9..bacb550b415 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -118,7 +118,6 @@ class RootCollection extends SimpleCollection { $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 fd27b4d2776..d3b7ca92581 100644 --- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php @@ -32,12 +32,10 @@ namespace OCA\DAV\Tests\unit\BackgroundJob; 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 @@ class CleanupInvitationTokenJobTest extends TestCase { [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 991caafd597..1de56b37d80 100644 --- a/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/PruneOutdatedSyncTokensJobTest.php @@ -34,13 +34,14 @@ use OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob; 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 79d9376650b..e2b5390f875 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\IConfig; 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 = <<<EOD BEGIN:VCALENDAR PRODID:-//Nextcloud calendar v1.6.4 diff --git a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php index 4f3459233aa..bd5660747ff 100644 --- a/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php +++ b/apps/dav/tests/unit/CardDAV/Activity/BackendTest.php @@ -40,7 +40,6 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class BackendTest extends TestCase { - /** @var IManager|MockObject */ protected $activityManager; @@ -53,6 +52,9 @@ class BackendTest extends TestCase { /** @var IAppManager|MockObject */ protected $appManager; + /** @var IUserManager|MockObject */ + protected $userManager; + protected function setUp(): void { parent::setUp(); $this->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 7cd31e3b8dd..2614f541613 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -54,7 +54,6 @@ use Sabre\DAV\PropPatch; use Test\TestCase; class PrincipalTest extends TestCase { - /** @var IUserManager | MockObject */ private $userManager; @@ -658,12 +657,12 @@ class PrincipalTest extends TestCase { $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 576fde2d4af..efbad5e3008 100644 --- a/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php +++ b/apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php @@ -37,14 +37,12 @@ use OCP\AppFramework\Utility\ITimeFactory; 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 @@ EOF; ->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 04761e35410..a9148987d38 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 45c7ceb61ef..45bd5a3d707 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 @@ class ShareTest extends TestCase { $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 @@ class ShareTest extends TestCase { $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 12010995560..5d16d58fc0a 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -44,7 +44,6 @@ use OCP\UserInterface; 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 2a9c1ee58ec..eddf6fa3811 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 @@ Set your password: https://example.com/resetPassword/MySuperLongSecureRandomToke Install Client: https://nextcloud.com/install/#install-clients --- +-- TestCloud This is an automatically sent email, please do not reply. EOF; @@ -601,7 +603,7 @@ Go to TestCloud: https://example.com/ Install Client: https://nextcloud.com/install/#install-clients --- +-- TestCloud This is an automatically sent email, please do not reply. EOF; @@ -822,7 +824,7 @@ Go to TestCloud: https://example.com/ 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 f8f6052a0f8..4e9be5ef994 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 @@ class PersonalTest extends TestCase { $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 1a0f0adebec..3e92d03e473 100644 --- a/apps/theming/tests/Themes/DyslexiaFontTest.php +++ b/apps/theming/tests/Themes/DyslexiaFontTest.php @@ -40,10 +40,11 @@ use OCP\IUserSession; 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 acf95b1e271..f9ad1f72ab8 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -89,7 +89,6 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OC\User */ class Session implements IUserSession, Emitter { - /** @var Manager $manager */ private $manager; @@ -448,7 +447,6 @@ class Session implements IUserSession, Emitter { // 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 @@ class Session implements IUserSession, Emitter { // 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 7d4dc6de2d6..b2419e07683 100644 --- a/tests/lib/Share20/ShareTest.php +++ b/tests/lib/Share20/ShareTest.php @@ -23,6 +23,7 @@ namespace Test\Share20; use OCP\Files\IRootFolder; use OCP\IUserManager; +use PHPUnit\Framework\MockObject\MockObject; /** * Class ShareTest @@ -30,9 +31,10 @@ use OCP\IUserManager; * @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; |