1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Updated tests to use ssddanbrown/asserthtml package

Closes #3519
This commit is contained in:
Dan Brown
2022-07-23 15:10:18 +01:00
parent cf73e5f2c6
commit 72c8b138e1
48 changed files with 869 additions and 1014 deletions

View File

@ -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');
}
}