-<?php namespace Tests;
+<?php namespace Tests\Permissions;
-use BookStack\Entities\Book;
-use BookStack\Entities\Bookshelf;
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Entity;
+use BookStack\Entities\Models\Book;
+use BookStack\Entities\Models\Bookshelf;
+use BookStack\Entities\Models\Chapter;
+use BookStack\Entities\Models\Entity;
use BookStack\Auth\User;
-use BookStack\Entities\Repos\EntityRepo;
-use BookStack\Entities\Page;
+use BookStack\Entities\Models\Page;
+use Tests\BrowserKitTest;
class RestrictionsTest extends BrowserKitTest
{
/**
- * @var \BookStack\Auth\User
+ * @var User
*/
protected $user;
public function test_bookshelf_update_restriction()
{
- $shelf = BookShelf::first();
+ $shelf = Bookshelf::first();
$this->actingAs($this->user)
->visit($shelf->getUrl('/edit'))
public function test_page_view_restriction()
{
- $page = \BookStack\Entities\Page::first();
+ $page = Page::first();
$pageUrl = $page->getUrl();
$this->actingAs($this->user)
public function test_page_delete_restriction()
{
- $page = \BookStack\Entities\Page::first();
+ $page = Page::first();
$pageUrl = $page->getUrl();
$this->actingAs($this->user)
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')
$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 = [