Skip to content

NOW MANAGED ON CODEBERG

Testing: Fixed issues during pre-release testing

Dan Brown13dae24cbe3f
diff --git a/app/Sorting/SortSetOperationComparisons.php b/app/Sorting/SortSetOperationComparisons.php
index 0d8e58264..e34652315 100644
--- a/app/Sorting/SortSetOperationComparisons.php
+++ b/app/Sorting/SortSetOperationComparisons.php
@@ -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
diff --git a/app/Translation/LocaleManager.php b/app/Translation/LocaleManager.php
index 0e2e7372f..86e712bee 100644
--- a/app/Translation/LocaleManager.php
+++ b/app/Translation/LocaleManager.php
@@ -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',
diff --git a/tests/Meta/LicensesTest.php b/tests/Meta/LicensesTest.php
index 0d6af2555..a50fbdb90 100644
--- a/tests/Meta/LicensesTest.php
+++ b/tests/Meta/LicensesTest.php
@@ -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');
}
diff --git a/tests/Sorting/SortRuleTest.php b/tests/Sorting/SortRuleTest.php
index 85b3d7991..e956f49df 100644
--- a/tests/Sorting/SortRuleTest.php
+++ b/tests/Sorting/SortRuleTest.php
@@ -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();