mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Entity Repo & Controller Refactor (#1690)
* Started mass-refactoring of the current entity repos * Rewrote book tree logic - Now does two simple queries instead of one really complex one. - Extracted logic into its own class. - Remove model-level akward union field listing. - Logic now more readable than being large separate query and compilation functions. * Extracted and split book sort logic * Finished up Book controller/repo organisation * Refactored bookshelves controllers and repo parts * Fixed issues found via phpunit * Refactored Chapter controller * Updated Chapter export controller * Started Page controller/repo refactor * Refactored another chunk of PageController * Completed initial pagecontroller refactor pass * Fixed tests and continued reduction of old repos * Removed old page remove and further reduced entity repo * Removed old entity repo, split out page controller * Ran phpcbf and split out some page content methods * Tidied up some EntityProvider elements * Fixed issued caused by viewservice change
This commit is contained in:
@ -5,14 +5,13 @@ use BookStack\Entities\Bookshelf;
|
||||
use BookStack\Entities\Chapter;
|
||||
use BookStack\Entities\Entity;
|
||||
use BookStack\Auth\User;
|
||||
use BookStack\Entities\Repos\EntityRepo;
|
||||
use BookStack\Entities\Page;
|
||||
|
||||
class RestrictionsTest extends BrowserKitTest
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \BookStack\Auth\User
|
||||
* @var User
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
@ -327,7 +326,7 @@ class RestrictionsTest extends BrowserKitTest
|
||||
|
||||
public function test_page_view_restriction()
|
||||
{
|
||||
$page = \BookStack\Entities\Page::first();
|
||||
$page = Page::first();
|
||||
|
||||
$pageUrl = $page->getUrl();
|
||||
$this->actingAs($this->user)
|
||||
@ -367,7 +366,7 @@ class RestrictionsTest extends BrowserKitTest
|
||||
|
||||
public function test_page_delete_restriction()
|
||||
{
|
||||
$page = \BookStack\Entities\Page::first();
|
||||
$page = Page::first();
|
||||
|
||||
$pageUrl = $page->getUrl();
|
||||
$this->actingAs($this->user)
|
||||
@ -438,7 +437,7 @@ class RestrictionsTest extends BrowserKitTest
|
||||
|
||||
public function test_page_restriction_form()
|
||||
{
|
||||
$page = \BookStack\Entities\Page::first();
|
||||
$page = Page::first();
|
||||
$this->asAdmin()->visit($page->getUrl() . '/permissions')
|
||||
->see('Page Permissions')
|
||||
->check('restricted')
|
||||
@ -665,10 +664,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
$this->setEntityRestrictions($firstBook, ['view', 'update']);
|
||||
$this->setEntityRestrictions($secondBook, ['view']);
|
||||
|
||||
$firstBookChapter = $this->app[EntityRepo::class]->createFromInput('chapter',
|
||||
['name' => 'first book chapter'], $firstBook);
|
||||
$secondBookChapter = $this->app[EntityRepo::class]->createFromInput('chapter',
|
||||
['name' => 'second book chapter'], $secondBook);
|
||||
$firstBookChapter = $this->newChapter(['name' => 'first book chapter'], $firstBook);
|
||||
$secondBookChapter = $this->newChapter(['name' => 'second book chapter'], $secondBook);
|
||||
|
||||
// Create request data
|
||||
$reqData = [
|
||||
|
Reference in New Issue
Block a user