Testing: Fixed issues during pre-release testing
Some checks failed
analyse-php / build (push) Has been cancelled
lint-js / build (push) Has been cancelled
lint-php / build (push) Has been cancelled
test-js / build (push) Has been cancelled
test-migrations / build (8.2) (push) Has been cancelled
test-migrations / build (8.3) (push) Has been cancelled
test-migrations / build (8.4) (push) Has been cancelled
test-php / build (8.2) (push) Has been cancelled
test-php / build (8.3) (push) Has been cancelled
test-php / build (8.4) (push) Has been cancelled

- Updated locale list
- Fixed new name sorting not being case insensitive
- Updated license test to account for changed deps
This commit is contained in:
Dan Brown 2025-02-26 14:19:03 +00:00
parent 6211d6bcfc
commit 13dae24cbe
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 38 additions and 3 deletions

View File

@ -13,12 +13,12 @@ class SortSetOperationComparisons
{
public static function nameAsc(Entity $a, Entity $b): int
{
return $a->name <=> $b->name;
return strtolower($a->name) <=> strtolower($b->name);
}
public static function nameDesc(Entity $a, Entity $b): int
{
return $b->name <=> $a->name;
return strtolower($b->name) <=> strtolower($a->name);
}
public static function nameNumericAsc(Entity $a, Entity $b): int

View File

@ -47,6 +47,7 @@ class LocaleManager
'ja' => 'ja',
'ka' => 'ka_GE',
'ko' => 'ko_KR',
'ku' => 'ku_TR',
'lt' => 'lt_LT',
'lv' => 'lv_LV',
'nb' => 'nb_NO',

View File

@ -13,7 +13,7 @@ class LicensesTest extends TestCase
$resp->assertSee('Licenses');
$resp->assertSee('PHP Library Licenses');
$resp->assertSee('Dan Brown and the BookStack project contributors');
$resp->assertSee('doctrine/dbal');
$resp->assertSee('league/commonmark');
$resp->assertSee('@codemirror/lang-html');
}

View File

@ -187,6 +187,40 @@ class SortRuleTest extends TestCase
$this->assertNotEquals($oldPriority, $chapter->priority);
}
public function test_name_alphabetical_ordering()
{
$book = Book::factory()->create();
$rule = SortRule::factory()->create(['sequence' => 'name_asc']);
$book->sort_rule_id = $rule->id;
$book->save();
$this->permissions->regenerateForEntity($book);
$namesToAdd = [
"Beans",
"bread",
"Milk",
"pizza",
"Tomato",
];
$reverseNamesToAdd = array_reverse($namesToAdd);
foreach ($reverseNamesToAdd as $name) {
$this->actingAsApiEditor()->post("/api/pages", [
'book_id' => $book->id,
'name' => $name,
'markdown' => 'Hello'
]);
}
foreach ($namesToAdd as $index => $name) {
$this->assertDatabaseHas('pages', [
'book_id' => $book->id,
'name' => $name,
'priority' => $index + 1,
]);
}
}
public function test_name_numeric_ordering()
{
$book = Book::factory()->create();