From d106e0c92d3d066f6286b5fc78614a17ea2a4441 Mon Sep 17 00:00:00 2001 From: Bastian Waidelich Date: Wed, 20 Mar 2024 12:17:25 +0100 Subject: [PATCH] Fix MariaDB support in `FactoryTest` Apparently MariaDB does not contain the ``` (using password: YES) ``` substring in the authentication error message. By making that substring optional in the corresponding regex check, the tests are green for me (11.1.2-MariaDB @ Macbook Pro M1) --- tests/Io/FactoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Io/FactoryTest.php b/tests/Io/FactoryTest.php index 6675abd..ac05dab 100644 --- a/tests/Io/FactoryTest.php +++ b/tests/Io/FactoryTest.php @@ -169,13 +169,13 @@ public function testConnectWithInvalidPassRejectsWithAuthenticationError() $this->logicalAnd( $this->isInstanceOf('RuntimeException'), $this->callback(function (\RuntimeException $e) { - return !!preg_match("/^Connection to mysql:\/\/[^ ]* failed during authentication: Access denied for user '.*?'@'.*?' \(using password: YES\) \(EACCES\)$/", $e->getMessage()); + return !!preg_match("/^Connection to mysql:\/\/[^ ]* failed during authentication: Access denied for user '.*?'@'.*?'( \(using password: YES\))? \(EACCES\)$/", $e->getMessage()); }), $this->callback(function (\RuntimeException $e) { return $e->getCode() === (defined('SOCKET_EACCES') ? SOCKET_EACCES : 13); }), $this->callback(function (\RuntimeException $e) { - return !!preg_match("/^Access denied for user '.*?'@'.*?' \(using password: YES\)$/", $e->getPrevious()->getMessage()); + return !!preg_match("/^Access denied for user '.*?'@'.*?'( \(using password: YES\))?$/", $e->getPrevious()->getMessage()); }) ) ));