X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b56f7355aa3a44c8529073fc2a3e760d0404f2ad..refs/pull/3918/head:/tests/Entity/BookTest.php diff --git a/tests/Entity/BookTest.php b/tests/Entity/BookTest.php index 2914162cf..9e2750fd0 100644 --- a/tests/Entity/BookTest.php +++ b/tests/Entity/BookTest.php @@ -225,18 +225,18 @@ class BookTest extends TestCase setting()->putUser($editor, 'books_view_type', 'list'); $resp = $this->actingAs($editor)->get('/books'); - $this->withHtml($resp)->assertElementContains('form[action$="/settings/users/' . $editor->id . '/switch-books-view"]', 'Grid View'); - $this->withHtml($resp)->assertElementExists('input[name="view_type"][value="grid"]'); + $this->withHtml($resp)->assertElementContains('form[action$="/preferences/change-view/books"]', 'Grid View'); + $this->withHtml($resp)->assertElementExists('button[name="view"][value="grid"]'); - $resp = $this->patch("/settings/users/{$editor->id}/switch-books-view", ['view_type' => 'grid']); + $resp = $this->patch("/preferences/change-view/books", ['view' => 'grid']); $resp->assertRedirect(); $this->assertEquals('grid', setting()->getUser($editor, 'books_view_type')); $resp = $this->actingAs($editor)->get('/books'); - $this->withHtml($resp)->assertElementContains('form[action$="/settings/users/' . $editor->id . '/switch-books-view"]', 'List View'); - $this->withHtml($resp)->assertElementExists('input[name="view_type"][value="list"]'); + $this->withHtml($resp)->assertElementContains('form[action$="/preferences/change-view/books"]', 'List View'); + $this->withHtml($resp)->assertElementExists('button[name="view"][value="list"]'); - $resp = $this->patch("/settings/users/{$editor->id}/switch-books-view", ['view_type' => 'list']); + $resp = $this->patch("/preferences/change-view/books", ['view_type' => 'list']); $resp->assertRedirect(); $this->assertEquals('list', setting()->getUser($editor, 'books_view_type')); } @@ -304,9 +304,7 @@ class BookTest extends TestCase // Hide child content /** @var BookChild $page */ foreach ($book->getDirectChildren() as $child) { - $child->restricted = true; - $child->save(); - $this->entities->regenPermissions($child); + $this->entities->setPermissions($child, [], []); } $this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book']);