From 5fbdcd4a26728facad668572565722f7c8b74d9c Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 5 Jul 2023 21:43:03 +0200 Subject: [PATCH] Fix PHPUnit 10 deprecations --- tests/Util/Database/StaticDatabase.php | 1 - tests/src/App/BaseURLTest.php | 2 +- tests/src/Content/Text/BBCodeTest.php | 3 +++ tests/src/Model/User/CookieTest.php | 7 ++++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/Util/Database/StaticDatabase.php b/tests/Util/Database/StaticDatabase.php index be2ec99f0b..3ae497e9af 100644 --- a/tests/Util/Database/StaticDatabase.php +++ b/tests/Util/Database/StaticDatabase.php @@ -60,7 +60,6 @@ class StaticDatabase extends Database $this->driver = 'pdo'; $this->connection = self::$staticConnection; $this->connected = true; - $this->emulate_prepares = false; return $this->connected; } diff --git a/tests/src/App/BaseURLTest.php b/tests/src/App/BaseURLTest.php index e45b30b20a..fb79fd4d3c 100644 --- a/tests/src/App/BaseURLTest.php +++ b/tests/src/App/BaseURLTest.php @@ -178,7 +178,7 @@ class BaseURLTest extends MockedTest public function testRedirectException() { self::expectException(InternalServerErrorException::class); - self::expectErrorMessage('https://friendica.other is not a relative path, please use System::externalRedirect'); + self::expectExceptionMessage('https://friendica.other is not a relative path, please use System::externalRedirect'); $config = new ReadOnlyFileConfig(new Cache([ 'system' => [ diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php index 889b12caa2..fc8fd4bff5 100644 --- a/tests/src/Content/Text/BBCodeTest.php +++ b/tests/src/Content/Text/BBCodeTest.php @@ -28,6 +28,9 @@ use Friendica\Test\FixtureTest; class BBCodeTest extends FixtureTest { + /** @var \HTMLPurifier */ + public $HTMLPurifier; + protected function setUp(): void { parent::setUp(); diff --git a/tests/src/Model/User/CookieTest.php b/tests/src/Model/User/CookieTest.php index 372645bf3f..ebe78764ba 100644 --- a/tests/src/Model/User/CookieTest.php +++ b/tests/src/Model/User/CookieTest.php @@ -231,11 +231,12 @@ class CookieTest extends MockedTest $data = json_decode(StaticCookie::$_COOKIE[Cookie::NAME]); - self::assertObjectHasAttribute('uid', $data); + self::assertIsObject($data); + self::assertTrue(property_exists($data, 'uid')); self::assertEquals($uid, $data->uid); - self::assertObjectHasAttribute('hash', $data); + self::assertTrue(property_exists($data, 'hash')); self::assertEquals($hash, $data->hash); - self::assertObjectHasAttribute('ip', $data); + self::assertTrue(property_exists($data, 'ip')); self::assertEquals($remoteIp, $data->ip); self::assertLessThanOrEqual(time() + Cookie::DEFAULT_EXPIRE * 24 * 60 * 60, StaticCookie::$_EXPIRE); -- 2.39.5