]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/PagesApiTest.php
respective book and chapter structure added.
[bookstack] / tests / Api / PagesApiTest.php
index a1f65692f05822482047af88878c9d139746f0af..22659d5bb726bf011403ce14cc728d810bde861a 100644 (file)
@@ -27,43 +27,15 @@ class PagesApiTest extends TestCase
                 'slug'     => $firstPage->slug,
                 'book_id'  => $firstPage->book->id,
                 'priority' => $firstPage->priority,
+                'owned_by'   => $firstPage->owned_by,
+                'created_by' => $firstPage->created_by,
+                'updated_by' => $firstPage->updated_by,
+                'revision_count' => $firstPage->revision_count,
             ],
         ]]);
     }
 
     public function test_create_endpoint()
-    {
-        $this->actingAsApiEditor();
-        $book = $this->entities->book();
-        $details = [
-            'name'    => 'My API page',
-            'book_id' => $book->id,
-            'html'    => '<p>My new page content</p>',
-            'tags'    => [
-                [
-                    'name'  => 'tagname',
-                    'value' => 'tagvalue',
-                ],
-            ],
-        ];
-
-        $resp = $this->postJson($this->baseEndpoint, $details);
-        unset($details['html']);
-        $resp->assertStatus(200);
-        $newItem = Page::query()->orderByDesc('id')->where('name', '=', $details['name'])->first();
-        $resp->assertJson(array_merge($details, ['id' => $newItem->id, 'slug' => $newItem->slug]));
-        $this->assertDatabaseHas('tags', [
-            'entity_id'   => $newItem->id,
-            'entity_type' => $newItem->getMorphClass(),
-            'name'        => 'tagname',
-            'value'       => 'tagvalue',
-        ]);
-        $resp->assertSeeText('My new page content');
-        $resp->assertJsonMissing(['book' => []]);
-        $this->assertActivityExists('page_create', $newItem);
-    }
-
-    public function test_create_applies_correct_priority()
     {
         $this->actingAsApiEditor();
         $book = $this->entities->book();