0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-20 15:09:38 +00:00

Testing: Fixed issues during pre-release testing

- 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
tests/Sorting

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();