X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b1b8067cbe79d7ca2bca9021ab9d37465b0c44fe..refs/pull/5280/head:/tests/Permissions/RolePermissionsTest.php diff --git a/tests/Permissions/RolePermissionsTest.php b/tests/Permissions/RolePermissionsTest.php index 0b2e16686..d3146bd47 100644 --- a/tests/Permissions/RolePermissionsTest.php +++ b/tests/Permissions/RolePermissionsTest.php @@ -44,14 +44,13 @@ class RolePermissionsTest extends TestCase public function test_user_cannot_change_email_unless_they_have_manage_users_permission() { - $userProfileUrl = '/settings/users/' . $this->user->id; $originalEmail = $this->user->email; $this->actingAs($this->user); - $resp = $this->get($userProfileUrl) - ->assertOk(); + $resp = $this->get('/my-account/profile')->assertOk(); $this->withHtml($resp)->assertElementExists('input[name=email][disabled]'); - $this->put($userProfileUrl, [ + $resp->assertSee('Unfortunately you don\'t have permission to change your email address.'); + $this->put('/my-account/profile', [ 'name' => 'my_new_name', 'email' => 'new_email@example.com', ]); @@ -63,11 +62,12 @@ class RolePermissionsTest extends TestCase $this->permissions->grantUserRolePermissions($this->user, ['users-manage']); - $resp = $this->get($userProfileUrl) - ->assertOk(); - $this->withHtml($resp)->assertElementNotExists('input[name=email][disabled]') + $resp = $this->get('/my-account/profile')->assertOk(); + $this->withHtml($resp) + ->assertElementNotExists('input[name=email][disabled]') ->assertElementExists('input[name=email]'); - $this->put($userProfileUrl, [ + + $this->put('/my-account/profile', [ 'name' => 'my_new_name_2', 'email' => 'new_email@example.com', ]); @@ -738,16 +738,12 @@ class RolePermissionsTest extends TestCase private function addComment(Page $page): TestResponse { - $comment = Comment::factory()->make(); - - return $this->postJson("/comment/$page->id", $comment->only('text', 'html')); + return $this->postJson("/comment/$page->id", ['html' => '
New comment content
']); } private function updateComment(Comment $comment): TestResponse { - $commentData = Comment::factory()->make(); - - return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html')); + return $this->putJson("/comment/{$comment->id}", ['html' => 'Updated comment content
']); } private function deleteComment(Comment $comment): TestResponse