]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/ExportTest.php
Code cleanup, bug squashing
[bookstack] / tests / Entity / ExportTest.php
index 683f23674d66ed6997c947c2d2fe409b67994f86..e022f92f5d66bf8f067faa8c6c838ff8331a135c 100644 (file)
@@ -1,8 +1,11 @@
-<?php namespace Tests;
+<?php namespace Tests\Entity;
 
 
-use BookStack\Entities\Chapter;
-use BookStack\Entities\Page;
+use BookStack\Entities\Models\Chapter;
+use BookStack\Entities\Models\Page;
+use BookStack\Uploads\HttpFetcher;
+use Illuminate\Support\Str;
+use Tests\TestCase;
 
 class ExportTest extends TestCase
 {
@@ -78,7 +81,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 +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