]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/ExportTest.php
Update settings.php
[bookstack] / tests / Entity / ExportTest.php
index fdcd833665d267f380631110fc2fc51a7a6b6f27..5a94adac91c4b8d8dc46866f897e45f7057c3808 100644 (file)
@@ -1,8 +1,11 @@
-<?php namespace Tests;
+<?php namespace Tests\Entity;
 
 
 use BookStack\Entities\Chapter;
 use BookStack\Entities\Page;
+use BookStack\Uploads\HttpFetcher;
+use Illuminate\Support\Str;
+use Tests\TestCase;
 
 class ExportTest extends TestCase
 {
@@ -76,6 +79,20 @@ class ExportTest extends TestCase
         $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $book->slug . '.html"');
     }
 
+    public function test_book_html_export_shows_chapter_descriptions()
+    {
+        $chapterDesc = 'My custom test chapter description ' . Str::random(12);
+        $chapter = Chapter::query()->first();
+        $chapter->description = $chapterDesc;
+        $chapter->save();
+
+        $book = $chapter->book;
+        $this->asEditor();
+
+        $resp = $this->get($book->getUrl('/export/html'));
+        $resp->assertSee($chapterDesc);
+    }
+
     public function test_chapter_text_export()
     {
         $chapter = Chapter::first();
@@ -134,4 +151,17 @@ class ExportTest extends TestCase
         $resp->assertDontSee($page->updated_at->diffForHumans());
     }
 
+    public function test_page_export_sets_right_data_type_for_svg_embeds()
+    {
+        $page = Page::first();
+        $page->html = '<img src="http://example.com/image.svg">';
+        $page->save();
+
+        $this->asEditor();
+        $this->mockHttpFetch('<svg></svg>');
+        $resp = $this->get($page->getUrl('/export/html'));
+        $resp->assertStatus(200);
+        $resp->assertSee('<img src="data:image/svg+xml;base64');
+    }
+
 }
\ No newline at end of file