SQLite test database uses case-sensitive collation while production MySQL uses case-insensitive, causing test failures for case-insensitive string operations.
public function testUsernameCaseConsistency(): void
{
$user = User::factory()->create([
'User' => 'NicoPlaysThings',
]);
$variations = [
'NICOPLAYSTHINGS',
'nicoplaysthings',
'NicoPlaysThings',
];
foreach ($variations as $input) {
$response = $this->get($this->apiUrl('GetUserSummary', ['u' => $input]));
$response->assertOk()
->assertJsonPath('User', 'NicoPlaysThings')
->assertJsonPath('LastActivity.User', 'NicoPlaysThings')
->assertJsonPath('UserPic', '/UserPic/NicoPlaysThings.png');
}
}
Describe the bug
Originated during discussion of PR #2854
SQLite test database uses case-sensitive collation while production MySQL uses case-insensitive, causing test failures for case-insensitive string operations.
To Reproduce
Steps to reproduce the behavior:
tests/Feature/Api/V1/UserSummaryTest.phpand add the following test case:php artisan test tests/Feature/Api/V1/UserSummaryTest.php --filter testUsernameCaseConsistencyExpected behavior
Additional context
_cicollation by default