Skip to content

Add case-insensitive collation settings to SQLite test database #2868

Open
@G3mha

Description

@G3mha

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:

  1. 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');
    }
}
  1. Run the test involving case-insensitive username lookups:
php artisan test tests/Feature/Api/V1/UserSummaryTest.php --filter testUsernameCaseConsistency
  1. Observe test failure due to collation mismatch
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/databaseThis issue is caused by a problem in the databasekind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions