File tree 4 files changed +38
-3
lines changed
4 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ class SortSetOperationComparisons
13
13
{
14
14
public static function nameAsc (Entity $ a , Entity $ b ): int
15
15
{
16
- return $ a ->name <=> $ b ->name ;
16
+ return strtolower ( $ a ->name ) <=> strtolower ( $ b ->name ) ;
17
17
}
18
18
19
19
public static function nameDesc (Entity $ a , Entity $ b ): int
20
20
{
21
- return $ b ->name <=> $ a ->name ;
21
+ return strtolower ( $ b ->name ) <=> strtolower ( $ a ->name ) ;
22
22
}
23
23
24
24
public static function nameNumericAsc (Entity $ a , Entity $ b ): int
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class LocaleManager
47
47
'ja ' => 'ja ' ,
48
48
'ka ' => 'ka_GE ' ,
49
49
'ko ' => 'ko_KR ' ,
50
+ 'ku ' => 'ku_TR ' ,
50
51
'lt ' => 'lt_LT ' ,
51
52
'lv ' => 'lv_LV ' ,
52
53
'nb ' => 'nb_NO ' ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public function test_licenses_endpoint()
13
13
$ resp ->assertSee ('Licenses ' );
14
14
$ resp ->assertSee ('PHP Library Licenses ' );
15
15
$ resp ->assertSee ('Dan Brown and the BookStack project contributors ' );
16
- $ resp ->assertSee ('doctrine/dbal ' );
16
+ $ resp ->assertSee ('league/commonmark ' );
17
17
$ resp ->assertSee ('@codemirror/lang-html ' );
18
18
}
19
19
Original file line number Diff line number Diff line change @@ -187,6 +187,40 @@ public function test_auto_book_sort_does_not_touch_timestamps()
187
187
$ this ->assertNotEquals ($ oldPriority , $ chapter ->priority );
188
188
}
189
189
190
+ public function test_name_alphabetical_ordering ()
191
+ {
192
+ $ book = Book::factory ()->create ();
193
+ $ rule = SortRule::factory ()->create (['sequence ' => 'name_asc ' ]);
194
+ $ book ->sort_rule_id = $ rule ->id ;
195
+ $ book ->save ();
196
+ $ this ->permissions ->regenerateForEntity ($ book );
197
+
198
+ $ namesToAdd = [
199
+ "Beans " ,
200
+ "bread " ,
201
+ "Milk " ,
202
+ "pizza " ,
203
+ "Tomato " ,
204
+ ];
205
+
206
+ $ reverseNamesToAdd = array_reverse ($ namesToAdd );
207
+ foreach ($ reverseNamesToAdd as $ name ) {
208
+ $ this ->actingAsApiEditor ()->post ("/api/pages " , [
209
+ 'book_id ' => $ book ->id ,
210
+ 'name ' => $ name ,
211
+ 'markdown ' => 'Hello '
212
+ ]);
213
+ }
214
+
215
+ foreach ($ namesToAdd as $ index => $ name ) {
216
+ $ this ->assertDatabaseHas ('pages ' , [
217
+ 'book_id ' => $ book ->id ,
218
+ 'name ' => $ name ,
219
+ 'priority ' => $ index + 1 ,
220
+ ]);
221
+ }
222
+ }
223
+
190
224
public function test_name_numeric_ordering ()
191
225
{
192
226
$ book = Book::factory ()->create ();
You can’t perform that action at this time.
0 commit comments