X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b9306a9029f41f3779b755d08c907a2edafc33df..9186e77d27ea9c620ba0e45de77bdb64c198ca8c:/tests/Sorting/BookSortTest.php diff --git a/tests/Sorting/BookSortTest.php b/tests/Sorting/BookSortTest.php index b30cec8b6..4737ec231 100644 --- a/tests/Sorting/BookSortTest.php +++ b/tests/Sorting/BookSortTest.php @@ -1,6 +1,6 @@ entities->bookHasChaptersAndPages(); + $chapter = $book->chapters()->first(); + \DB::table('chapters')->where('id', '=', $chapter->id)->update([ + 'priority' => 10001, + 'updated_at' => \Carbon\Carbon::now()->subYear(5), + ]); + + $chapter->refresh(); + $oldUpdatedAt = $chapter->updated_at->unix(); + + $sortData = [ + 'id' => $chapter->id, + 'sort' => 0, + 'parentChapter' => false, + 'type' => 'chapter', + 'book' => $book->id, + ]; + $this->asEditor()->put($book->getUrl('/sort'), ['sort-tree' => json_encode([$sortData])])->assertRedirect(); + + $chapter->refresh(); + $this->assertNotEquals(10001, $chapter->priority); + $this->assertEquals($oldUpdatedAt, $chapter->updated_at->unix()); + } + public function test_book_sort_item_returns_book_content() { $bookToSort = $this->entities->book();