From 640444c8d70f02087fffaba8a62c35204acc2a7b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 28 Jan 2021 22:27:26 +0100 Subject: [PATCH] [ticket/13713] Resolve issues with PHPUnit calls in PHP >= 8.0 PHPBB3-13713 --- tests/mention/controller_test.php | 19 +++++++++---------- .../s9e/mention_helper_test.php | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/mention/controller_test.php b/tests/mention/controller_test.php index 74c6a08f0c..3b50731791 100644 --- a/tests/mention/controller_test.php +++ b/tests/mention/controller_test.php @@ -668,16 +668,15 @@ class phpbb_mention_controller_test extends phpbb_database_test_case */ public function test_handle($keyword, $topic_id, $expected_result) { - $this->request->expects($this->at(1)) - ->method('variable') - ->with('keyword', '', true) - ->willReturn($keyword) - ; - $this->request->expects($this->at(2)) - ->method('variable') - ->with('topic_id', 0) - ->willReturn($topic_id) - ; + $this->request->expects($this->atLeast(2)) + ->method('variable') + ->withConsecutive( + ['keyword', '', true], + ['topic_id', 0]) + ->willReturnOnConsecutiveCalls( + $keyword, + $topic_id + ); $data = json_decode($this->controller->handle()->getContent(), true); $this->assertEquals($expected_result, $data); } diff --git a/tests/text_formatter/s9e/mention_helper_test.php b/tests/text_formatter/s9e/mention_helper_test.php index 7bd89fa843..ea53557c78 100644 --- a/tests/text_formatter/s9e/mention_helper_test.php +++ b/tests/text_formatter/s9e/mention_helper_test.php @@ -96,7 +96,7 @@ class mention_helper_test extends phpbb_database_test_case public function test_inject_metadata($incoming_xml, $expected_profile_substring) { $result = $this->mention_helper->inject_metadata($incoming_xml); - $this->assertContains($expected_profile_substring, $result); + $this->assertStringContainsString($expected_profile_substring, $result); } public function get_mentioned_user_ids_data()