From a6da60317b31d6f4f72153a8dc8de296b3cd9766 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Apr 2024 12:05:18 +0200 Subject: [PATCH] fix(tests): Migrate to new method for regex matching Signed-off-by: Joas Schilling --- tests/integration/features/bootstrap/FeatureContext.php | 6 +++--- tests/integration/features/bootstrap/SharingContext.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 8bc716d4cf5..a85c9ae81af 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -2929,11 +2929,11 @@ public function userGetsTheFollowingCandidateMentionsInRoomFor($user, $identifie foreach ($expected as $key => $row) { if ($row['id'] === 'GUEST_ID') { - Assert::assertRegExp('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['id']); + Assert::assertMatchesRegularExpression('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['id']); $mentions[$key]['id'] = 'GUEST_ID'; } if ($row['mentionId'] === 'GUEST_ID') { - Assert::assertRegExp('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['mentionId']); + Assert::assertMatchesRegularExpression('/^guest\/[0-9a-f]{40}$/', $mentions[$key]['mentionId']); $mentions[$key]['mentionId'] = 'GUEST_ID'; } if (str_ends_with($row['id'], '@{$BASE_URL}')) { @@ -2949,7 +2949,7 @@ public function userGetsTheFollowingCandidateMentionsInRoomFor($user, $identifie $row['mentionId'] = str_replace('{$REMOTE_URL}', rtrim($this->baseRemoteUrl, '/'), $row['mentionId']); } if (array_key_exists('avatar', $row)) { - Assert::assertRegExp('/' . self::$identifierToToken[$row['avatar']] . '\/avatar/', $mentions[$key]['avatar']); + Assert::assertMatchesRegularExpression('/' . self::$identifierToToken[$row['avatar']] . '\/avatar/', $mentions[$key]['avatar']); unset($row['avatar']); } unset($mentions[$key]['avatar']); diff --git a/tests/integration/features/bootstrap/SharingContext.php b/tests/integration/features/bootstrap/SharingContext.php index 70b47abd69e..b36d5e389df 100644 --- a/tests/integration/features/bootstrap/SharingContext.php +++ b/tests/integration/features/bootstrap/SharingContext.php @@ -983,9 +983,9 @@ private function assertFieldIsInReturnedShare(string $field, string $contentExpe } elseif ($contentExpected === 'A_TOKEN') { // A token is composed by 15 characters from // ISecureRandom::CHAR_HUMAN_READABLE. - \PHPUnit\Framework\Assert::assertRegExp('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare[$field], "Field '$field' is not a token"); + \PHPUnit\Framework\Assert::assertMatchesRegularExpression('/^[abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789]{15}$/', (string)$returnedShare[$field], "Field '$field' is not a token"); } elseif (strpos($contentExpected, 'REGEXP ') === 0) { - \PHPUnit\Framework\Assert::assertRegExp(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare[$field], "Field '$field' does not match"); + \PHPUnit\Framework\Assert::assertMatchesRegularExpression(substr($contentExpected, strlen('REGEXP ')), (string)$returnedShare[$field], "Field '$field' does not match"); } else { \PHPUnit\Framework\Assert::assertEquals($contentExpected, (string)$returnedShare[$field], "Field '$field' does not match"); }