0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-04-23 04:10:22 +00:00

Applied styleci style changes

This commit is contained in:
Dan Brown 2021-09-18 21:21:44 +01:00
parent 6454e24657
commit c08c8d7aa3
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
10 changed files with 51 additions and 55 deletions

View file

@ -244,7 +244,7 @@ class AuthTest extends TestCase
'email' => 'admin@admin.com', 'email' => 'admin@admin.com',
'password' => 'randompass', 'password' => 'randompass',
'password_confirmation' => 'randompass', 'password_confirmation' => 'randompass',
'token' => $n->first()->token 'token' => $n->first()->token,
]); ]);
$resp->assertRedirect('/'); $resp->assertRedirect('/');
@ -260,13 +260,12 @@ class AuthTest extends TestCase
$resp->assertSee('A password reset link will be sent to barry@admin.com if that email address is found in the system.'); $resp->assertSee('A password reset link will be sent to barry@admin.com if that email address is found in the system.');
$resp->assertDontSee('We can\'t find a user'); $resp->assertDontSee('We can\'t find a user');
$this->get('/password/reset/arandometokenvalue')->assertSee('Reset Password'); $this->get('/password/reset/arandometokenvalue')->assertSee('Reset Password');
$resp = $this->post('/password/reset', [ $resp = $this->post('/password/reset', [
'email' => 'barry@admin.com', 'email' => 'barry@admin.com',
'password' => 'randompass', 'password' => 'randompass',
'password_confirmation' => 'randompass', 'password_confirmation' => 'randompass',
'token' => 'arandometokenvalue' 'token' => 'arandometokenvalue',
]); ]);
$resp->assertRedirect('/password/reset/arandometokenvalue'); $resp->assertRedirect('/password/reset/arandometokenvalue');

View file

@ -227,7 +227,7 @@ class PageTest extends TestCase
// Need to save twice since revisions are not generated in seeder. // Need to save twice since revisions are not generated in seeder.
$this->asAdmin()->put($page->getUrl(), [ $this->asAdmin()->put($page->getUrl(), [
'name' => 'super test', 'name' => 'super test',
'html' => '<p></p>' 'html' => '<p></p>',
]); ]);
$page->refresh(); $page->refresh();
@ -235,7 +235,7 @@ class PageTest extends TestCase
$this->put($pageUrl, [ $this->put($pageUrl, [
'name' => 'super test page', 'name' => 'super test page',
'html' => '<p></p>' 'html' => '<p></p>',
]); ]);
$this->get($pageUrl) $this->get($pageUrl)
@ -280,5 +280,4 @@ class PageTest extends TestCase
$this->get('/') $this->get('/')
->assertElementContains('#recently-updated-pages', $page->name); ->assertElementContains('#recently-updated-pages', $page->name);
} }
} }

View file

@ -167,7 +167,6 @@ class EntityPermissionsTest extends TestCase
]); ]);
$resp->assertRedirect($book->getUrl('/chapter/test-chapter')); $resp->assertRedirect($book->getUrl('/chapter/test-chapter'));
$this->get($book->getUrl('/create-page')); $this->get($book->getUrl('/create-page'));
/** @var Page $page */ /** @var Page $page */
$page = Page::query()->where('draft', '=', true)->orderBy('id', 'desc')->first(); $page = Page::query()->where('draft', '=', true)->orderBy('id', 'desc')->first();
@ -404,8 +403,8 @@ class EntityPermissionsTest extends TestCase
'restricted' => 'true', 'restricted' => 'true',
'restrictions' => [ 'restrictions' => [
$roleId => [ $roleId => [
$permission => 'true' $permission => 'true',
] ],
], ],
]); ]);
@ -561,7 +560,6 @@ class EntityPermissionsTest extends TestCase
]); ]);
$resp->assertRedirect($book->getUrl('/chapter/test-chapter')); $resp->assertRedirect($book->getUrl('/chapter/test-chapter'));
$this->get($book->getUrl('/create-page')); $this->get($book->getUrl('/create-page'));
/** @var Page $page */ /** @var Page $page */
$page = Page::query()->where('draft', '=', true)->orderByDesc('id')->first(); $page = Page::query()->where('draft', '=', true)->orderByDesc('id')->first();
@ -730,7 +728,6 @@ class EntityPermissionsTest extends TestCase
$this->setRestrictionsForTestRoles($bookChapter, ['view', 'create']); $this->setRestrictionsForTestRoles($bookChapter, ['view', 'create']);
$this->get($bookChapter->getUrl('/create-page')); $this->get($bookChapter->getUrl('/create-page'));
/** @var Page $page */ /** @var Page $page */
$page = Page::query()->where('draft', '=', true)->orderByDesc('id')->first(); $page = Page::query()->where('draft', '=', true)->orderByDesc('id')->first();

View file

@ -927,12 +927,14 @@ class RolesTest extends TestCase
private function addComment(Page $page): TestResponse private function addComment(Page $page): TestResponse
{ {
$comment = factory(Comment::class)->make(); $comment = factory(Comment::class)->make();
return $this->postJson("/comment/$page->id", $comment->only('text', 'html')); return $this->postJson("/comment/$page->id", $comment->only('text', 'html'));
} }
private function updateComment(Comment $comment): TestResponse private function updateComment(Comment $comment): TestResponse
{ {
$commentData = factory(Comment::class)->make(); $commentData = factory(Comment::class)->make();
return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html')); return $this->putJson("/comment/{$comment->id}", $commentData->only('text', 'html'));
} }

View file

@ -213,6 +213,7 @@ trait SharedTestHelpers
/** /**
* Create a group of entities that belong to a specific user. * Create a group of entities that belong to a specific user.
*
* @return array{book: Book, chapter: Chapter, page: Page} * @return array{book: Book, chapter: Chapter, page: Page}
*/ */
protected function createEntityChainBelongingToUser(User $creatorUser, ?User $updaterUser = null): array protected function createEntityChainBelongingToUser(User $creatorUser, ?User $updaterUser = null): array

View file

@ -12,7 +12,6 @@ use Tests\TestCase;
class UserManagementTest extends TestCase class UserManagementTest extends TestCase
{ {
public function test_user_creation() public function test_user_creation()
{ {
/** @var User $user */ /** @var User $user */
@ -48,12 +47,11 @@ class UserManagementTest extends TestCase
$user = $this->getNormalUser(); $user = $this->getNormalUser();
$password = $user->password; $password = $user->password;
$resp = $this->asAdmin()->get('/settings/users/' . $user->id); $resp = $this->asAdmin()->get('/settings/users/' . $user->id);
$resp->assertSee($user->email); $resp->assertSee($user->email);
$this->put($user->getEditUrl(), [ $this->put($user->getEditUrl(), [
'name' => 'Barry Scott' 'name' => 'Barry Scott',
])->assertRedirect('/settings/users'); ])->assertRedirect('/settings/users');
$this->assertDatabaseHas('users', ['id' => $user->id, 'name' => 'Barry Scott', 'password' => $password]); $this->assertDatabaseHas('users', ['id' => $user->id, 'name' => 'Barry Scott', 'password' => $password]);
@ -70,7 +68,7 @@ class UserManagementTest extends TestCase
$this->asAdmin()->get($userProfilePage); $this->asAdmin()->get($userProfilePage);
$this->put($userProfilePage, [ $this->put($userProfilePage, [
'password' => 'newpassword' 'password' => 'newpassword',
])->assertRedirect($userProfilePage); ])->assertRedirect($userProfilePage);
$this->get($userProfilePage)->assertSee('Password confirmation required'); $this->get($userProfilePage)->assertSee('Password confirmation required');