From: Dan Brown Date: Sun, 27 Oct 2019 16:44:41 +0000 (+0000) Subject: Merge branch 'fix/#1662' of git://github.com/cw1998/BookStack into cw1998-fix/#1662 X-Git-Tag: v0.28.0~1^2~52^2~1 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/28184c6bfc3c6cf88f31e41862f98241708a836a?ds=inline;hp=-c Merge branch 'fix/#1662' of git://github.com/cw1998/BookStack into cw1998-fix/#1662 --- 28184c6bfc3c6cf88f31e41862f98241708a836a diff --combined tests/Entity/EntityTest.php index b506da2aa,c28ca8b3e..3d12ed749 --- a/tests/Entity/EntityTest.php +++ b/tests/Entity/EntityTest.php @@@ -1,8 -1,10 +1,9 @@@ createEntityChainBelongingToUser($creator, $updater); $this->actingAs($creator); app(UserRepo::class)->destroy($creator); - app(PageRepo::class)->savePageRevision($entities['page']); + app(PageRepo::class)->update($entities['page'], ['html' => '

hello!

>']); $this->checkEntitiesViewable($entities); } @@@ -204,7 -206,7 +205,7 @@@ $entities = $this->createEntityChainBelongingToUser($creator, $updater); $this->actingAs($updater); app(UserRepo::class)->destroy($updater); - app(PageRepo::class)->savePageRevision($entities['page']); + app(PageRepo::class)->update($entities['page'], ['html' => '

Hello there!

']); $this->checkEntitiesViewable($entities); } @@@ -272,7 -274,8 +273,7 @@@ public function test_slug_multi_byte_lower_casing() { - $entityRepo = app(EntityRepo::class); - $book = $entityRepo->createFromInput('book', [ + $book = $this->newBook([ 'name' => 'КНИГА' ]); @@@ -282,11 -285,37 +283,36 @@@ public function test_slug_format() { - $entityRepo = app(EntityRepo::class); - $book = $entityRepo->createFromInput('book', [ + $book = $this->newBook([ 'name' => 'PartA / PartB / PartC' ]); $this->assertEquals('parta-partb-partc', $book->slug); } + public function test_shelf_cancel_creation_returns_to_correct_place() + { + $shelf = Bookshelf::first(); + + // Cancel button from shelf goes back to shelf + $this->asEditor()->visit($shelf->getUrl('/create-book')) + ->see('Cancel') + ->click('Cancel') + ->seePageIs($shelf->getUrl()); + + // Cancel button from books goes back to books + $this->asEditor()->visit('/create-book') + ->see('Cancel') + ->click('Cancel') + ->seePageIs('/books'); + + // Cancel button from book edit goes back to book + $book = Book::first(); + + $this->asEditor()->visit($book->getUrl('/edit')) + ->see('Cancel') + ->click('Cancel') + ->seePageIs($book->getUrl()); + } + }