X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/3598/head:/tests/RecycleBinTest.php diff --git a/tests/RecycleBinTest.php b/tests/RecycleBinTest.php index 1c5445212..0e0524338 100644 --- a/tests/RecycleBinTest.php +++ b/tests/RecycleBinTest.php @@ -8,8 +8,8 @@ use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Deletion; use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\Page; -use DB; use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\DB; class RecycleBinTest extends TestCase { @@ -63,11 +63,12 @@ class RecycleBinTest extends TestCase $this->actingAs($editor)->delete($book->getUrl()); $viewReq = $this->asAdmin()->get('/settings/recycle-bin'); - $viewReq->assertElementContains('table.table', $page->name); - $viewReq->assertElementContains('table.table', $editor->name); - $viewReq->assertElementContains('table.table', $book->name); - $viewReq->assertElementContains('table.table', $book->pages_count . ' Pages'); - $viewReq->assertElementContains('table.table', $book->chapters_count . ' Chapters'); + $html = $this->withHtml($viewReq); + $html->assertElementContains('table.table', $page->name); + $html->assertElementContains('table.table', $editor->name); + $html->assertElementContains('table.table', $book->name); + $html->assertElementContains('table.table', $book->pages_count . ' Pages'); + $html->assertElementContains('table.table', $book->chapters_count . ' Chapters'); } public function test_recycle_bin_empty() @@ -90,7 +91,7 @@ class RecycleBinTest extends TestCase $itemCount = 2 + $book->pages->count() + $book->chapters->count(); $redirectReq = $this->get('/settings/recycle-bin'); - $redirectReq->assertNotificationContains('Deleted ' . $itemCount . ' total items from the recycle bin'); + $this->assertNotificationContains($redirectReq, 'Deleted ' . $itemCount . ' total items from the recycle bin'); } public function test_entity_restore() @@ -111,7 +112,7 @@ class RecycleBinTest extends TestCase $itemCount = 1 + $book->pages->count() + $book->chapters->count(); $redirectReq = $this->get('/settings/recycle-bin'); - $redirectReq->assertNotificationContains('Restored ' . $itemCount . ' total items from the recycle bin'); + $this->assertNotificationContains($redirectReq, 'Restored ' . $itemCount . ' total items from the recycle bin'); } public function test_permanent_delete() @@ -130,7 +131,7 @@ class RecycleBinTest extends TestCase $itemCount = 1 + $book->pages->count() + $book->chapters->count(); $redirectReq = $this->get('/settings/recycle-bin'); - $redirectReq->assertNotificationContains('Deleted ' . $itemCount . ' total items from the recycle bin'); + $this->assertNotificationContains($redirectReq, 'Deleted ' . $itemCount . ' total items from the recycle bin'); } public function test_permanent_delete_for_each_type() @@ -264,6 +265,6 @@ class RecycleBinTest extends TestCase $pageRestoreView = $this->asAdmin()->get("/settings/recycle-bin/{$pageDeletion->id}/restore"); $pageRestoreView->assertSee('The parent of this item has also been deleted.'); - $pageRestoreView->assertElementContains('a[href$="/settings/recycle-bin/' . $bookDeletion->id . '/restore"]', 'Restore Parent'); + $this->withHtml($pageRestoreView)->assertElementContains('a[href$="/settings/recycle-bin/' . $bookDeletion->id . '/restore"]', 'Restore Parent'); } }