1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 15:24:03 +00:00

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?
This commit is contained in:
Samuel Stancl 2026-05-01 16:25:37 +02:00
parent e400b28daa
commit c2c2ca2e6a
No known key found for this signature in database
GPG key ID: BA146259A1E16C57

View file

@ -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