Open
Description
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:
- Go to file
tests/Feature/Api/V1/UserSummaryTest.php
and add the following test case:
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');
}
}
- Run the test involving case-insensitive username lookups:
php artisan test tests/Feature/Api/V1/UserSummaryTest.php --filter testUsernameCaseConsistency
- Observe test failure due to collation mismatch
- See PR fix(API_GetUserSummary): handle username case sensitivity and use canonical username #2854 for the complete discussion on this error
Expected behavior
- SQLite test database should use case-insensitive collation matching MySQL's behavior
- Tests should pass regardless of username case variations
- UserSummary API tests should succeed with usernames like 'NICOPLAYSTHINGS', 'nicoplaysthings', 'NicoPlaysThings'
Additional context
- MySQL uses
_ci
collation by default - SQLite test environment needs equivalent case-insensitive configuration
- Issue affects test coverage as case-sensitivity tests must be omitted
- Reference PR fix(API_GetUserSummary): handle username case sensitivity and use canonical username #2854 where this caused test coverage gaps
- Environment: PHPUnit test suite using SQLite