diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-01 15:07:53 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-08-01 15:07:53 +0200 |
commit | cb271b759e27c4c26c0e60b7503350682aca33eb (patch) | |
tree | 8abf40b337b3f195a8bee32e02851a1e430c8c0a | |
parent | f74e89bde5892a68500eeea3fa98a511b1d7f7e9 (diff) | |
download | nextcloud-server-cb271b759e27c4c26c0e60b7503350682aca33eb.tar.gz nextcloud-server-cb271b759e27c4c26c0e60b7503350682aca33eb.zip |
Fix dynamic property creations in test files
This fixes warnings in PHP 8.2
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | apps/dav/lib/DAV/Sharing/Backend.php | 2 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php | 14 | ||||
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 2 | ||||
-rw-r--r-- | tests/lib/DirectEditing/ManagerTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Metadata/FileMetadataMapperTest.php | 6 | ||||
-rw-r--r-- | tests/lib/Repair/RepairMimeTypesTest.php | 1 | ||||
-rw-r--r-- | tests/lib/User/SessionTest.php | 2 |
7 files changed, 22 insertions, 9 deletions
diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index 92971992c20..90d2c7ebf82 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -179,7 +179,7 @@ class Backend { while ($row = $result->fetch()) { $p = $this->principalBackend->getPrincipalByPath($row['principaluri']); $shares[] = [ - 'href' => "principal:${row['principaluri']}", + 'href' => "principal:{$row['principaluri']}", 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', 'status' => 1, 'readOnly' => (int) $row['access'] === self::ACCESS_READ, diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index f2d2014d553..73d21746b64 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -27,7 +27,6 @@ */ namespace OCA\DAV\Tests\unit\CalDAV; -use OC\KnownUser\KnownUserService; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\Proxy\ProxyMapper; use OCA\DAV\Connector\Sabre\Principal; @@ -41,6 +40,8 @@ use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\Security\ISecureRandom; use OCP\Share\IManager as ShareManager; +use OC\KnownUser\KnownUserService; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet; use Sabre\DAV\Xml\Property\Href; @@ -58,15 +59,18 @@ abstract class AbstractCalDavBackend extends TestCase { /** @var CalDavBackend */ protected $backend; - /** @var Principal | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Principal | MockObject */ protected $principal; - /** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IUserManager|MockObject */ protected $userManager; - /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IGroupManager|MockObject */ protected $groupManager; - /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IEventDispatcher|MockObject */ protected $dispatcher; + + /** @var IConfig | MockObject */ + private $config; /** @var ISecureRandom */ private $random; /** @var LoggerInterface*/ diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 110e55bcc6c..f23635aa01b 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -952,7 +952,7 @@ class Cache implements ICache { * use the one with the highest id gives the best result with the background scanner, since that is most * likely the folder where we stopped scanning previously * - * @return string|bool the path of the folder or false when no folder matched + * @return string|false the path of the folder or false when no folder matched */ public function getIncomplete() { $query = $this->getQueryBuilder(); diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index b00de02bcf5..e19c44b1a06 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -106,6 +106,10 @@ class ManagerTest extends TestCase { */ private $userFolder; /** + * @var MockObject|IL10N + */ + private $l10n; + /** * @var MockObject|IManager */ private $encryptionManager; diff --git a/tests/lib/Metadata/FileMetadataMapperTest.php b/tests/lib/Metadata/FileMetadataMapperTest.php index 8e385351be2..1a005f24b8a 100644 --- a/tests/lib/Metadata/FileMetadataMapperTest.php +++ b/tests/lib/Metadata/FileMetadataMapperTest.php @@ -24,6 +24,7 @@ namespace Test\Metadata; use OC\Metadata\FileMetadataMapper; use OC\Metadata\FileMetadata; +use PHPUnit\Framework\MockObject\MockObject; /** * @group DB @@ -33,9 +34,12 @@ class FileMetadataMapperTest extends \Test\TestCase { /** @var IDBConnection */ protected $connection; - /** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */ + /** @var SystemConfig|MockObject */ protected $config; + /** @var FileMetadataMapper|MockObject */ + protected $mapper; + protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index 26a52459c24..53c8e53d486 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -36,7 +36,6 @@ class RepairMimeTypesTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->savedMimetypeLoader = \OC::$server->getMimeTypeLoader(); $this->mimetypeLoader = \OC::$server->getMimeTypeLoader(); /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject $config */ diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 0e199e5d5b5..735a3b3d06a 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -43,6 +43,8 @@ use OC\Security\CSRF\CsrfTokenManager; class SessionTest extends \Test\TestCase { /** @var ITimeFactory|MockObject */ private $timeFactory; + /** @var IProvider|MockObject */ + private $tokenProvider; /** @var IConfig|MockObject */ private $config; /** @var Throttler|MockObject */ |