mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Re-structured the app code to be feature based rather than code type based
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
<?php namespace Tests;
|
||||
|
||||
use BookStack\Book;
|
||||
use BookStack\Bookshelf;
|
||||
use BookStack\Chapter;
|
||||
use BookStack\Entity;
|
||||
use BookStack\Page;
|
||||
use BookStack\Repos\EntityRepo;
|
||||
use BookStack\Repos\PermissionsRepo;
|
||||
use BookStack\Role;
|
||||
use BookStack\Services\PermissionService;
|
||||
use BookStack\Services\SettingService;
|
||||
use BookStack\Entities\Book;
|
||||
use BookStack\Entities\Bookshelf;
|
||||
use BookStack\Entities\Chapter;
|
||||
use BookStack\Entities\Entity;
|
||||
use BookStack\Entities\Page;
|
||||
use BookStack\Entities\EntityRepo;
|
||||
use BookStack\Auth\Permissions\PermissionsRepo;
|
||||
use BookStack\Auth\Role;
|
||||
use BookStack\Auth\Permissions\PermissionService;
|
||||
use BookStack\Settings\SettingService;
|
||||
|
||||
trait SharedTestHelpers
|
||||
{
|
||||
@ -67,7 +67,7 @@ trait SharedTestHelpers
|
||||
*/
|
||||
protected function getViewer($attributes = [])
|
||||
{
|
||||
$user = \BookStack\Role::getRole('viewer')->users()->first();
|
||||
$user = \BookStack\Auth\Role::getRole('viewer')->users()->first();
|
||||
if (!empty($attributes)) $user->forceFill($attributes)->save();
|
||||
return $user;
|
||||
}
|
||||
@ -85,7 +85,7 @@ trait SharedTestHelpers
|
||||
/**
|
||||
* Create and return a new bookshelf.
|
||||
* @param array $input
|
||||
* @return Bookshelf
|
||||
* @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);
|
||||
@ -104,7 +104,7 @@ trait SharedTestHelpers
|
||||
* Create and return a new test chapter
|
||||
* @param array $input
|
||||
* @param Book $book
|
||||
* @return Chapter
|
||||
* @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);
|
||||
@ -164,10 +164,10 @@ trait SharedTestHelpers
|
||||
|
||||
/**
|
||||
* Give the given user some permissions.
|
||||
* @param \BookStack\User $user
|
||||
* @param \BookStack\Auth\User $user
|
||||
* @param array $permissions
|
||||
*/
|
||||
protected function giveUserPermissions(\BookStack\User $user, $permissions = [])
|
||||
protected function giveUserPermissions(\BookStack\Auth\User $user, $permissions = [])
|
||||
{
|
||||
$newRole = $this->createNewRole($permissions);
|
||||
$user->attachRole($newRole);
|
||||
|
Reference in New Issue
Block a user