]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/PageRevisionTest.php
Fixed tests from streaming changes
[bookstack] / tests / Entity / PageRevisionTest.php
index 2ed7d3b411e86b8990cc0b000740ec2a79a26bbd..fc6678788636df222c405f34e58823643b4c3be2 100644 (file)
@@ -144,13 +144,14 @@ class PageRevisionTest extends TestCase
 
     public function test_revision_deletion()
     {
-        $page = Page::first();
+        /** @var Page $page */
+        $page = Page::query()->first();
         $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
 
-        $page = Page::find($page->id);
+        $page->refresh();
         $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
 
-        $page = Page::find($page->id);
+        $page->refresh();
         $beforeRevisionCount = $page->revisions->count();
 
         // Delete the first revision
@@ -158,18 +159,17 @@ class PageRevisionTest extends TestCase
         $resp = $this->asEditor()->delete($revision->getUrl('/delete/'));
         $resp->assertRedirect($page->getUrl('/revisions'));
 
-        $page = Page::find($page->id);
+        $page->refresh();
         $afterRevisionCount = $page->revisions->count();
 
         $this->assertTrue($beforeRevisionCount === ($afterRevisionCount + 1));
 
         // Try to delete the latest revision
         $beforeRevisionCount = $page->revisions->count();
-        $currentRevision = $page->getCurrentRevision();
-        $resp = $this->asEditor()->delete($currentRevision->getUrl('/delete/'));
+        $resp = $this->asEditor()->delete($page->currentRevision->getUrl('/delete/'));
         $resp->assertRedirect($page->getUrl('/revisions'));
 
-        $page = Page::find($page->id);
+        $page->refresh();
         $afterRevisionCount = $page->revisions->count();
         $this->assertTrue($beforeRevisionCount === $afterRevisionCount);
     }