X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/21f2a7087c7ef1af1e30e1997bce77cc64ede76e..refs/pull/3593/head:/tests/Entity/ChapterTest.php diff --git a/tests/Entity/ChapterTest.php b/tests/Entity/ChapterTest.php index 1d28ec839..5a761b94f 100644 --- a/tests/Entity/ChapterTest.php +++ b/tests/Entity/ChapterTest.php @@ -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() @@ -85,7 +85,7 @@ class ChapterTest extends TestCase $otherBook = Book::query()->where('id', '!=', $chapter->book_id)->first(); $resp = $this->asEditor()->post($chapter->getUrl('/copy'), [ - 'name' => 'My copied chapter', + 'name' => 'My copied chapter', 'entity_selection' => 'book:' . $otherBook->id, ]);