1
0
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:
Dan Brown
2018-09-25 12:30:50 +01:00
parent 19751ed1cb
commit 919660678b
109 changed files with 684 additions and 531 deletions

View File

@ -6,18 +6,18 @@ class PublicActionTest extends BrowserKitTest
public function test_app_not_public()
{
$this->setSettings(['app-public' => 'false']);
$book = \BookStack\Book::orderBy('name', 'asc')->first();
$book = \BookStack\Entities\Book::orderBy('name', 'asc')->first();
$this->visit('/books')->seePageIs('/login');
$this->visit($book->getUrl())->seePageIs('/login');
$page = \BookStack\Page::first();
$page = \BookStack\Entities\Page::first();
$this->visit($page->getUrl())->seePageIs('/login');
}
public function test_books_viewable()
{
$this->setSettings(['app-public' => 'true']);
$books = \BookStack\Book::orderBy('name', 'asc')->take(10)->get();
$books = \BookStack\Entities\Book::orderBy('name', 'asc')->take(10)->get();
$bookToVisit = $books[1];
// Check books index page is showing
@ -34,7 +34,7 @@ class PublicActionTest extends BrowserKitTest
public function test_chapters_viewable()
{
$this->setSettings(['app-public' => 'true']);
$chapterToVisit = \BookStack\Chapter::first();
$chapterToVisit = \BookStack\Entities\Chapter::first();
$pageToVisit = $chapterToVisit->pages()->first();
// Check chapters index page is showing
@ -52,15 +52,15 @@ class PublicActionTest extends BrowserKitTest
public function test_public_page_creation()
{
$this->setSettings(['app-public' => 'true']);
$publicRole = \BookStack\Role::getSystemRole('public');
$publicRole = \BookStack\Auth\Role::getSystemRole('public');
// Grant all permissions to public
$publicRole->permissions()->detach();
foreach (\BookStack\RolePermission::all() as $perm) {
foreach (\BookStack\Auth\Permissions\RolePermission::all() as $perm) {
$publicRole->attachPermission($perm);
}
$this->app[\BookStack\Services\PermissionService::class]->buildJointPermissionForRole($publicRole);
$this->app[\BookStack\Auth\Permissions\PermissionService::class]->buildJointPermissionForRole($publicRole);
$chapter = \BookStack\Chapter::first();
$chapter = \BookStack\Entities\Chapter::first();
$this->visit($chapter->book->getUrl());
$this->visit($chapter->getUrl())
->click('New Page')
@ -71,7 +71,7 @@ class PublicActionTest extends BrowserKitTest
'name' => 'My guest page'
])->seePageIs($chapter->book->getUrl('/page/my-guest-page/edit'));
$user = \BookStack\User::getDefault();
$user = \BookStack\Auth\User::getDefault();
$this->seeInDatabase('pages', [
'name' => 'My guest page',
'chapter_id' => $chapter->id,
@ -82,7 +82,7 @@ class PublicActionTest extends BrowserKitTest
public function test_content_not_listed_on_404_for_public_users()
{
$page = \BookStack\Page::first();
$page = \BookStack\Entities\Page::first();
$this->asAdmin()->visit($page->getUrl());
\Auth::logout();
view()->share('pageTitle', '');