1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Removed browserkit from a couple of classess

Done a little reorganisation while there of misplaced tests.
Moved MarkdownTest to a new PageEditorTest to avoid confusion with
other markdown elements and to align with other page tests.
This commit is contained in:
Dan Brown
2021-09-13 22:54:21 +01:00
parent 8565187138
commit badaf08e55
9 changed files with 220 additions and 221 deletions

View File

@@ -211,6 +211,25 @@ trait SharedTestHelpers
return $permissionRepo->saveNewRole($roleData);
}
/**
* Create a group of entities that belong to a specific user.
*/
protected function createEntityChainBelongingToUser(User $creatorUser, ?User $updaterUser = null): array
{
if (empty($updaterUser)) {
$updaterUser = $creatorUser;
}
$userAttrs = ['created_by' => $creatorUser->id, 'owned_by' => $creatorUser->id, 'updated_by' => $updaterUser->id];
$book = factory(Book::class)->create($userAttrs);
$chapter = factory(Chapter::class)->create(array_merge(['book_id' => $book->id], $userAttrs));
$page = factory(Page::class)->create(array_merge(['book_id' => $book->id, 'chapter_id' => $chapter->id], $userAttrs));
$restrictionService = $this->app[PermissionService::class];
$restrictionService->buildJointPermissionsForEntity($book);
return compact('book', 'chapter', 'page');
}
/**
* Mock the HttpFetcher service and return the given data on fetch.
*/