parent
f9fcc9f3c7
commit
08b39500b3
3 changed files with 29 additions and 0 deletions
|
@ -158,6 +158,11 @@ class PermissionApplicator
|
|||
$query->select('id')->from('pages')
|
||||
->whereColumn('pages.id', '=', $fullPageIdColumn)
|
||||
->where('pages.draft', '=', false);
|
||||
})->orWhereExists(function (QueryBuilder $query) use ($fullPageIdColumn) {
|
||||
$query->select('id')->from('pages')
|
||||
->whereColumn('pages.id', '=', $fullPageIdColumn)
|
||||
->where('pages.draft', '=', true)
|
||||
->where('pages.created_by', '=', $this->currentUser()->id);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -184,6 +184,19 @@ class EntityProvider
|
|||
return $pageRepo->publishDraft($draftPage, $input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return a new test draft page.
|
||||
*/
|
||||
public function newDraftPage(array $input = ['name' => 'test page', 'html' => 'My new test page']): Page
|
||||
{
|
||||
$book = $this->book();
|
||||
$pageRepo = app(PageRepo::class);
|
||||
$draftPage = $pageRepo->getNewDraftPage($book);
|
||||
$pageRepo->updatePageDraft($draftPage, $input);
|
||||
$this->addToCache($draftPage);
|
||||
return $draftPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Entity|Entity[] $entities
|
||||
*/
|
||||
|
|
|
@ -120,6 +120,17 @@ class ImageTest extends TestCase
|
|||
$this->withHtml($searchFailRequest)->assertElementNotExists('div');
|
||||
}
|
||||
|
||||
public function test_image_gallery_lists_for_draft_page()
|
||||
{
|
||||
$this->actingAs($this->users->editor());
|
||||
$draft = $this->entities->newDraftPage();
|
||||
$this->files->uploadGalleryImageToPage($this, $draft);
|
||||
$image = Image::query()->where('uploaded_to', '=', $draft->id)->firstOrFail();
|
||||
|
||||
$resp = $this->get("/images/gallery?page=1&uploaded_to={$draft->id}");
|
||||
$resp->assertSee($image->getThumb(150, 150));
|
||||
}
|
||||
|
||||
public function test_image_usage()
|
||||
{
|
||||
$page = $this->entities->page();
|
||||
|
|
Loading…
Reference in a new issue