From c2c2ca2e6a2cfb99a8a9a8701c41d5c13953f56f Mon Sep 17 00:00:00 2001 From: Samuel Stancl Date: Fri, 1 May 2026 16:25:37 +0200 Subject: [PATCH] use a different encoding than utf8 in tests, more robust assertions Before we were really just testing utf8 twice. With this change tests start failing in a way that makes it seem like passing *just* ENCODING isn't sufficient - if the encoding differs from the server locale we may need to pass LC_COLLATE / LC_CTYPE or some other things? --- tests/TenantDatabaseManagerTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/TenantDatabaseManagerTest.php b/tests/TenantDatabaseManagerTest.php index d9dd05c8..870a78f3 100644 --- a/tests/TenantDatabaseManagerTest.php +++ b/tests/TenantDatabaseManagerTest.php @@ -568,12 +568,17 @@ test('newly created postgres databases use the correct charset', function (strin ->selectOne('SELECT pg_encoding_to_char(encoding) AS encoding FROM pg_database WHERE datname = ?', [$databaseName]) ->encoding; - $expectedCharset = $charset !== null ? strtoupper($charset) : $serverCharset; + if ($charset) { + expect($dbCharset)->toBe(strtoupper($charset)); + } else { + expect($dbCharset)->toBe($serverCharset); - expect($dbCharset)->toBe($expectedCharset); + // Server charset should be UTF8 by default + expect($dbCharset)->toBe('UTF8'); + } })->with([ null, - 'utf8', + 'latin1', ]); // Datasets