mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Extracted many page-specific repo methods into page-specific repo
This commit is contained in:
@ -5,10 +5,11 @@ use BookStack\Entities\Bookshelf;
|
||||
use BookStack\Entities\Chapter;
|
||||
use BookStack\Entities\Entity;
|
||||
use BookStack\Entities\Page;
|
||||
use BookStack\Entities\EntityRepo;
|
||||
use BookStack\Entities\Repos\EntityRepo;
|
||||
use BookStack\Auth\Permissions\PermissionsRepo;
|
||||
use BookStack\Auth\Role;
|
||||
use BookStack\Auth\Permissions\PermissionService;
|
||||
use BookStack\Entities\Repos\PageRepo;
|
||||
use BookStack\Settings\SettingService;
|
||||
|
||||
trait SharedTestHelpers
|
||||
@ -78,7 +79,7 @@ trait SharedTestHelpers
|
||||
*/
|
||||
protected function regenEntityPermissions(Entity $entity)
|
||||
{
|
||||
$this->app[PermissionService::class]->buildJointPermissionsForEntity($entity);
|
||||
app(PermissionService::class)->buildJointPermissionsForEntity($entity);
|
||||
$entity->load('jointPermissions');
|
||||
}
|
||||
|
||||
@ -88,7 +89,7 @@ trait SharedTestHelpers
|
||||
* @return \BookStack\Entities\Bookshelf
|
||||
*/
|
||||
public function newShelf($input = ['name' => 'test shelf', 'description' => 'My new test shelf']) {
|
||||
return $this->app[EntityRepo::class]->createFromInput('bookshelf', $input, false);
|
||||
return app(EntityRepo::class)->createFromInput('bookshelf', $input, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +98,7 @@ trait SharedTestHelpers
|
||||
* @return Book
|
||||
*/
|
||||
public function newBook($input = ['name' => 'test book', 'description' => 'My new test book']) {
|
||||
return $this->app[EntityRepo::class]->createFromInput('book', $input, false);
|
||||
return app(EntityRepo::class)->createFromInput('book', $input, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +108,7 @@ trait SharedTestHelpers
|
||||
* @return \BookStack\Entities\Chapter
|
||||
*/
|
||||
public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) {
|
||||
return $this->app[EntityRepo::class]->createFromInput('chapter', $input, $book);
|
||||
return app(EntityRepo::class)->createFromInput('chapter', $input, $book);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,9 +118,9 @@ trait SharedTestHelpers
|
||||
*/
|
||||
public function newPage($input = ['name' => 'test page', 'html' => 'My new test page']) {
|
||||
$book = Book::first();
|
||||
$entityRepo = $this->app[EntityRepo::class];
|
||||
$draftPage = $entityRepo->getDraftPage($book);
|
||||
return $entityRepo->publishPageDraft($draftPage, $input);
|
||||
$pageRepo = app(PageRepo::class);
|
||||
$draftPage = $pageRepo->getDraftPage($book);
|
||||
return $pageRepo->publishPageDraft($draftPage, $input);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user