X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a21ca446332a7020e54bea15171d4b6233ea3ab8..refs/pull/5676/head:/tests/Entity/BookTest.php
diff --git a/tests/Entity/BookTest.php b/tests/Entity/BookTest.php
index c4872785b..51bf65d10 100644
--- a/tests/Entity/BookTest.php
+++ b/tests/Entity/BookTest.php
@@ -266,8 +266,8 @@ class BookTest extends TestCase
{
$book = $this->entities->book();
- $input = '
Test
Contenta
';
- $expected = 'Contenta
';
+ $input = 'Test
Contenta
';
+ $expected = 'Contenta
';
$this->asEditor()->put($book->getUrl(), [
'name' => $book->name,
@@ -278,6 +278,17 @@ class BookTest extends TestCase
$this->assertEquals($expected, $book->description_html);
}
+ public function test_show_view_displays_description_if_no_description_html_set()
+ {
+ $book = $this->entities->book();
+ $book->description_html = '';
+ $book->description = "My great\ndescription\n\nwith newlines";
+ $book->save();
+
+ $resp = $this->asEditor()->get($book->getUrl());
+ $resp->assertSee("My great
\ndescription
\n
\nwith newlines
", false);
+ }
+
public function test_show_view_has_copy_button()
{
$book = $this->entities->book();
@@ -306,7 +317,7 @@ class BookTest extends TestCase
$copy = Book::query()->where('name', '=', 'My copy book')->first();
$resp->assertRedirect($copy->getUrl());
- $this->assertEquals($book->getDirectChildren()->count(), $copy->getDirectChildren()->count());
+ $this->assertEquals($book->getDirectVisibleChildren()->count(), $copy->getDirectVisibleChildren()->count());
$this->get($copy->getUrl())->assertSee($book->description_html, false);
}
@@ -318,7 +329,7 @@ class BookTest extends TestCase
// Hide child content
/** @var BookChild $page */
- foreach ($book->getDirectChildren() as $child) {
+ foreach ($book->getDirectVisibleChildren() as $child) {
$this->permissions->setEntityPermissions($child, [], []);
}
@@ -326,7 +337,7 @@ class BookTest extends TestCase
/** @var Book $copy */
$copy = Book::query()->where('name', '=', 'My copy book')->first();
- $this->assertEquals(0, $copy->getDirectChildren()->count());
+ $this->assertEquals(0, $copy->getDirectVisibleChildren()->count());
}
public function test_copy_does_not_copy_pages_or_chapters_if_user_cant_create()