From 647289b07a8878bebd6d3ac6182625551ccb2cbd Mon Sep 17 00:00:00 2001 From: Divyajose <75604843+divya-intelli@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:42:38 +0530 Subject: [PATCH] Fix for deprecation Connection::tablePrefix() is deprecated (#979) --- .../src/Logger/ApigeeEdgeDebugToFileLogger.php | 3 +-- .../apigee_edge_test/src/Logger/SyslogToFileLogger.php | 4 +--- .../ApigeeEdgeFunctionalJavascriptTestBase.php | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/modules/apigee_edge_test/src/Logger/ApigeeEdgeDebugToFileLogger.php b/tests/modules/apigee_edge_test/src/Logger/ApigeeEdgeDebugToFileLogger.php index 29e1cb7a..9880edab 100644 --- a/tests/modules/apigee_edge_test/src/Logger/ApigeeEdgeDebugToFileLogger.php +++ b/tests/modules/apigee_edge_test/src/Logger/ApigeeEdgeDebugToFileLogger.php @@ -71,8 +71,7 @@ protected function syslogWrapper($level, $entry) { $log_path = \Drupal::service('file_system')->realpath('public://'); } // Add test prefix to the log file. - // @phpstan-ignore-next-line - $log_path .= '/apigee_edge_debug-' . str_replace('test', '', $this->database->tablePrefix()) . '.log'; + $log_path .= '/apigee_edge_debug-' . str_replace('test', '', $this->database->getPrefix()) . '.log'; // Do not fail a test just because the fail is not writable. @error_log($entry . PHP_EOL, 3, $log_path); } diff --git a/tests/modules/apigee_edge_test/src/Logger/SyslogToFileLogger.php b/tests/modules/apigee_edge_test/src/Logger/SyslogToFileLogger.php index 8a20d3c5..c3d5ea8a 100644 --- a/tests/modules/apigee_edge_test/src/Logger/SyslogToFileLogger.php +++ b/tests/modules/apigee_edge_test/src/Logger/SyslogToFileLogger.php @@ -61,9 +61,7 @@ protected function syslogWrapper($level, $entry) { $log_path = \Drupal::service('file_system')->realpath('public://'); } // Add test id as a suffix to the log file. - // @todo tablePrefix() is deprecated in Drupal 10.1 - // @phpstan-ignore-next-line - $log_path .= '/syslog-' . str_replace('test', '', $this->database->tablePrefix()) . '.log'; + $log_path .= '/syslog-' . str_replace('test', '', $this->database->getPrefix()) . '.log'; // Do not fail a test just because the fail is not writable. @error_log($entry . PHP_EOL, 3, $log_path); } diff --git a/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php b/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php index 0107ce16..b5794cb4 100644 --- a/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php +++ b/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php @@ -64,9 +64,7 @@ public function createScreenshot($filename_prefix = '', $set_background_color = } /** @var \Drupal\Core\Database\Connection $database */ $database = $this->container->get('database'); - // @todo tablePrefix() is deprecated in Drupal 10.1 - // @phpstan-ignore-next-line - $test_id = str_replace('test', '', $database->tablePrefix()); + $test_id = str_replace('test', '', $database->getPrefix()); // Add table suffix (test id) to the file name and ensure the generated // file name is unique. $filename = \Drupal::service('file_system')