]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/ExportTest.php
Add the "Create Shelf" resp. "Create Book" to the home view
[bookstack] / tests / Entity / ExportTest.php
index 683f23674d66ed6997c947c2d2fe409b67994f86..9a2d32028e4b26887c7d231b68df2b1887668e3a 100644 (file)
@@ -3,6 +3,8 @@
 
 use BookStack\Entities\Chapter;
 use BookStack\Entities\Page;
+use BookStack\Uploads\HttpFetcher;
+use Illuminate\Support\Str;
 
 class ExportTest extends TestCase
 {
@@ -78,7 +80,7 @@ class ExportTest extends TestCase
 
     public function test_book_html_export_shows_chapter_descriptions()
     {
-        $chapterDesc = 'My custom test chapter description ' . str_random(12);
+        $chapterDesc = 'My custom test chapter description ' . Str::random(12);
         $chapter = Chapter::query()->first();
         $chapter->description = $chapterDesc;
         $chapter->save();
@@ -148,4 +150,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