]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/PageRevisionTest.php
API: Added endpoints for reading image data
[bookstack] / tests / Entity / PageRevisionTest.php
index a272dc38bdbd911cf302679bc668dd0f091be3e7..3828bd06e4a66278c5a752882d51b7a992548715 100644 (file)
@@ -91,7 +91,7 @@ class PageRevisionTest extends TestCase
         $restoreReq->assertRedirect($page->getUrl());
 
         $pageView = $this->get($page->getUrl());
-        $this->assertDatabaseHas('pages', [
+        $this->assertDatabaseHasEntityData('page', [
             'id'       => $page->id,
             'markdown' => '## New Content def456',
         ]);
@@ -203,6 +203,18 @@ class PageRevisionTest extends TestCase
         $this->withHtml($resp)->assertElementContains('.item-list-row > div:nth-child(2)', 'Markdown)');
     }
 
+    public function test_revision_changes_link_not_shown_for_oldest_revision()
+    {
+        $page = $this->entities->page();
+        $this->createRevisions($page, 3, ['html' => 'new page html']);
+
+        $resp = $this->asAdmin()->get($page->refresh()->getUrl('/revisions'));
+        $html = $this->withHtml($resp);
+
+        $html->assertElementNotExists('.item-list > .item-list-row:last-child a[href*="/changes"]');
+        $html->assertElementContains('.item-list > .item-list-row:nth-child(2)', 'Changes');
+    }
+
     public function test_revision_restore_action_only_visible_with_permission()
     {
         $page = $this->entities->page();