From 70e2217d1c23dbe7062c188091c0d9f10a5bd84b Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Mon, 14 Nov 2022 16:14:35 +0100 Subject: [PATCH] Fix dynamic properties and other problems in tests for PHP 8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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 3d115f25adf..b7d49b565ac 100644 --- a/tests/lib/DB/MigrationsTest.php +++ b/tests/lib/DB/MigrationsTest.php @@ -31,7 +31,6 @@ use OCP\Migration\IMigrationStep; * @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 @@ class MigrationsTest extends \Test\TestCase { ->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 bb7bbbcd7c1..5301453c191 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -31,22 +31,23 @@ use PHPUnit\Framework\MockObject\MockObject; 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 4d90e304ab7..3dd8923362c 100644 --- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php +++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php @@ -35,18 +35,21 @@ use OCP\Security\ICrypto; 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 29ae33c3c93..cc13479b1d0 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -36,24 +36,26 @@ use OCP\Settings\ISettings; 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 { -- 2.39.5