@@ -56,6 +56,20 @@ public function test_chapter_markdown_export()
5656 $ resp ->assertSee ('My **chapter** description ' );
5757 }
5858
59+ public function test_chapter_markdown_export_pages_are_permission_controlled ()
60+ {
61+ $ chapter = $ this ->entities ->chapterHasPages ();
62+ $ page = $ chapter ->pages ()->first ();
63+ $ page ->name = 'MyPageWhichShouldNotBeFound ' ;
64+ $ page ->save ();
65+ $ this ->permissions ->disableEntityInheritedPermissions ($ page );
66+
67+ $ resp = $ this ->asEditor ()->get ($ chapter ->getUrl ('/export/markdown ' ));
68+
69+ $ resp ->assertSee ('# ' . $ chapter ->name );
70+ $ resp ->assertDontSee ('MyPageWhichShouldNotBeFound ' );
71+ }
72+
5973 public function test_book_markdown_export ()
6074 {
6175 $ book = Book::query ()->whereHas ('pages ' )->whereHas ('chapters ' )->first ();
@@ -76,6 +90,38 @@ public function test_book_markdown_export()
7690 $ resp ->assertSee ('My **chapter** description ' );
7791 }
7892
93+ public function test_book_markdown_export_chapters_are_permission_controlled ()
94+ {
95+ $ book = $ this ->entities ->bookHasChaptersAndPages ();
96+ $ chapter = $ book ->chapters ()->first ();
97+ $ page = $ chapter ->pages ()->first ();
98+ $ page ->name = 'MyPageWhichShouldNotBeFound ' ;
99+ $ page ->save ();
100+ $ chapter ->name = 'MyChapterWhichShouldNotBeFound ' ;
101+ $ chapter ->save ();
102+ $ this ->permissions ->disableEntityInheritedPermissions ($ chapter );
103+
104+ $ resp = $ this ->asEditor ()->get ($ book ->getUrl ('/export/markdown ' ));
105+
106+ $ resp ->assertSee ('# ' . $ book ->name );
107+ $ resp ->assertDontSee ('MyChapterWhichShouldNotBeFound ' );
108+ $ resp ->assertDontSee ('MyPageWhichShouldNotBeFound ' );
109+ }
110+
111+ public function test_book_markdown_export_direct_pages_are_permission_controlled ()
112+ {
113+ $ book = $ this ->entities ->bookHasChaptersAndPages ();
114+ $ page = $ book ->directPages ()->first ();
115+ $ page ->name = 'MyPageWhichShouldNotBeFound ' ;
116+ $ page ->save ();
117+ $ this ->permissions ->disableEntityInheritedPermissions ($ page );
118+
119+ $ resp = $ this ->asEditor ()->get ($ book ->getUrl ('/export/markdown ' ));
120+
121+ $ resp ->assertSee ('# ' . $ book ->name );
122+ $ resp ->assertDontSee ('MyPageWhichShouldNotBeFound ' );
123+ }
124+
79125 public function test_book_markdown_export_concats_immediate_pages_with_newlines ()
80126 {
81127 /** @var Book $book */
0 commit comments