From 261108b770156f472ed40b2d5baaacfd624f6ce4 Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Thu, 14 Nov 2024 16:21:20 +1100 Subject: [PATCH] issue #909: fix PHPUnit warnings --- tests/application_trait.php | 15 ++------------- tests/tool_dataflows_variables_test.php | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/tests/application_trait.php b/tests/application_trait.php index 47f1d6d3..2aae6a83 100644 --- a/tests/application_trait.php +++ b/tests/application_trait.php @@ -104,7 +104,7 @@ public function compatible_assertMatchesRegularExpression(string $pattern, strin if (method_exists($this, 'assertMatchesRegularExpression')) { $this->assertMatchesRegularExpression($pattern, $string, $message); } else { - $this->assertRegExp($pattern, $string, $message); + $this->assertDoesNotMatchRegularExpression($pattern, $string, $message); } } @@ -119,18 +119,7 @@ public function compatible_assertDoesNotMatchRegularExpression(string $pattern, if (method_exists($this, 'assertDoesNotMatchRegularExpression')) { $this->assertDoesNotMatchRegularExpression($pattern, $string, $message); } else { - $this->assertNotRegExp($pattern, $string, $message); - } - } - - /** - * Asserts that an error was expected - */ - public function compatible_expectError(): void { - if (method_exists($this, 'expectError')) { - $this->expectError(); - } else { - $this->expectException(\PHPUnit\Framework\Error\Error::class); + $this->assertDoesNotMatchRegularExpression($pattern, $string, $message); } } // @codingStandardsIgnoreEnd diff --git a/tests/tool_dataflows_variables_test.php b/tests/tool_dataflows_variables_test.php index b630adbb..49d75e5b 100644 --- a/tests/tool_dataflows_variables_test.php +++ b/tests/tool_dataflows_variables_test.php @@ -140,7 +140,7 @@ public function test_variable_parsing_involving_indirect_self_recursion() { // Expecting it to throw an exception during execution, particularly // when preparing the SQL and finding out it contains an unparsed // expression. - $this->compatible_expectError(); + $this->expectException(\TypeError::class); try { $engine->execute(); } finally {