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

@ -19,10 +19,10 @@ class ChapterTest extends TestCase
]);
$resp = $this->asEditor()->get($book->getUrl());
$resp->assertElementContains('a[href="' . $book->getUrl('/create-chapter') . '"]', 'New Chapter');
$this->withHtml($resp)->assertElementContains('a[href="' . $book->getUrl('/create-chapter') . '"]', 'New Chapter');
$resp = $this->get($book->getUrl('/create-chapter'));
$resp->assertElementContains('form[action="' . $book->getUrl('/create-chapter') . '"][method="POST"]', 'Save Chapter');
$this->withHtml($resp)->assertElementContains('form[action="' . $book->getUrl('/create-chapter') . '"][method="POST"]', 'Save Chapter');
$resp = $this->post($book->getUrl('/create-chapter'), $chapter->only('name', 'description'));
$resp->assertRedirect($book->getUrl('/chapter/my-first-chapter'));
@ -53,7 +53,7 @@ class ChapterTest extends TestCase
$this->assertTrue($chapter->deletions()->count() === 1);
$redirectReq = $this->get($deleteReq->baseResponse->headers->get('location'));
$redirectReq->assertNotificationContains('Chapter Successfully Deleted');
$this->assertNotificationContains($redirectReq, 'Chapter Successfully Deleted');
}
public function test_show_view_has_copy_button()
@ -62,7 +62,7 @@ class ChapterTest extends TestCase
$chapter = Chapter::query()->first();
$resp = $this->asEditor()->get($chapter->getUrl());
$resp->assertElementContains("a[href$=\"{$chapter->getUrl('/copy')}\"]", 'Copy');
$this->withHtml($resp)->assertElementContains("a[href$=\"{$chapter->getUrl('/copy')}\"]", 'Copy');
}
public function test_copy_view()
@ -73,8 +73,8 @@ class ChapterTest extends TestCase
$resp = $this->asEditor()->get($chapter->getUrl('/copy'));
$resp->assertOk();
$resp->assertSee('Copy Chapter');
$resp->assertElementExists("input[name=\"name\"][value=\"{$chapter->name}\"]");
$resp->assertElementExists('input[name="entity_selection"]');
$this->withHtml($resp)->assertElementExists("input[name=\"name\"][value=\"{$chapter->name}\"]");
$this->withHtml($resp)->assertElementExists('input[name="entity_selection"]');
}
public function test_copy()