1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Added smarter page finding so changing the page name does not break old urls

Added page & book slug history to revisions so they can be looked up if a page is not found.
This commit is contained in:
Dan Brown
2016-02-25 20:01:59 +00:00
parent d339ab1125
commit 54e3122540
4 changed files with 86 additions and 3 deletions

View File

@@ -211,5 +211,18 @@ class EntityTest extends TestCase
->seeInNthElement('.entity-list .page', 0, $content['page']->name);
}
public function test_old_page_slugs_redirect_to_new_pages()
{
$page = \BookStack\Page::all()->first();
$pageUrl = $page->getUrl();
$newPageUrl = '/books/' . $page->book->slug . '/page/super-test-page';
$this->asAdmin()->visit($pageUrl)
->clickInElement('#content', 'Edit')
->type('super test page', '#name')
->press('Save Page')
->seePageIs($newPageUrl)
->visit($pageUrl)
->seePageIs($newPageUrl);
}
}