]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/BooksApiTest.php
ExportFormatter: Add book description and check for empty book and chapter descriptio...
[bookstack] / tests / Api / BooksApiTest.php
index b31bd7d37ee06e66de9940a1a710bc5ab2eab7ec..0de98dc323bf5ab14f8630075696a97a3f7e6118 100644 (file)
@@ -24,6 +24,9 @@ class BooksApiTest extends TestCase
                 'id'   => $firstBook->id,
                 'name' => $firstBook->name,
                 'slug' => $firstBook->slug,
+                'owned_by' => $firstBook->owned_by,
+                'created_by' => $firstBook->created_by,
+                'updated_by' => $firstBook->updated_by,
             ],
         ]]);
     }
@@ -146,6 +149,23 @@ class BooksApiTest extends TestCase
         ]);
     }
 
+    public function test_read_endpoint_contents_nested_pages_has_permissions_applied()
+    {
+        $this->actingAsApiEditor();
+
+        $book = $this->entities->bookHasChaptersAndPages();
+        $chapter = $book->chapters()->first();
+        $chapterPage = $chapter->pages()->first();
+        $customName = 'MyNonVisiblePageWithinAChapter';
+        $chapterPage->name = $customName;
+        $chapterPage->save();
+
+        $this->permissions->disableEntityInheritedPermissions($chapterPage);
+
+        $resp = $this->getJson($this->baseEndpoint . "/{$book->id}");
+        $resp->assertJsonMissing(['name' => $customName]);
+    }
+
     public function test_update_endpoint()
     {
         $this->actingAsApiEditor();