Skip to content

Commit 292bae9

Browse files
committed
Fix CLI test authentication on older PHP
Use caching_sha2_password for the external MySQL CLI regardless of the PHP runtime. Keep the PHP-version fallback for PDO and MySQLi clients. #540
1 parent d0b5007 commit 292bae9

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎packages/mysql-proxy/tests/WP_MySQL_Proxy_CLI_Test.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Symfony\Component\Process\Process;
4+
use WP_MySQL_Proxy\MySQL_Protocol;
45

56
class WP_MySQL_Proxy_CLI_Test extends WP_MySQL_Proxy_Test {
67
public function test_auth_without_password_is_denied(): void {
@@ -85,4 +86,9 @@ public function test_query(): void {
8586
$process->getOutput()
8687
);
8788
}
89+
90+
protected function get_auth_plugin(): string {
91+
// The external CLI's authentication support is independent of PHP's mysqlnd.
92+
return MySQL_Protocol::AUTH_PLUGIN_CACHING_SHA2_PASSWORD;
93+
}
8894
}

‎packages/mysql-proxy/tests/WP_MySQL_Proxy_Test.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function setUp(): void {
2121
'port' => $this->port,
2222
'db_path' => ':memory:',
2323
'log_level' => $this->log_level,
24-
'auth_plugin' => MySQL_Test_Client::auth_plugin(),
24+
'auth_plugin' => $this->get_auth_plugin(),
2525
)
2626
);
2727
}
@@ -40,4 +40,8 @@ public function tearDown(): void {
4040
);
4141
}
4242
}
43+
44+
protected function get_auth_plugin(): string {
45+
return MySQL_Test_Client::auth_plugin();
46+
}
4347
}

0 commit comments

Comments
 (0)