]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/PageContentTest.php
Updated base64 image extraction to use url instead of path
[bookstack] / tests / Entity / PageContentTest.php
index 670557b0c8f841f67c0ca82281e0cc92ae45e431..1b3af97c7c836de91dec418c5e78de57ecbd6233 100644 (file)
@@ -495,10 +495,10 @@ class PageContentTest extends TestCase
         ]);
 
         $page->refresh();
-        $this->assertStringMatchesFormat('%A<p%A>test<img src="/uploads/images/gallery/%A.jpeg">%A</p>%A', $page->html);
+        $this->assertStringMatchesFormat('%A<p%A>test<img src="http://localhost/uploads/images/gallery/%A.jpeg">%A</p>%A', $page->html);
 
         $matches = [];
-        preg_match('/src="(.*?)"/', $page->html, $matches);
+        preg_match('/src="https:\/\/p.rizon.top:443\/http\/localhost(.*?)"/', $page->html, $matches);
         $imagePath = $matches[1];
         $imageFile = public_path($imagePath);
         $this->assertEquals(base64_decode($this->base64Jpeg), file_get_contents($imageFile));
@@ -519,10 +519,10 @@ class PageContentTest extends TestCase
         ]);
 
         $page->refresh();
-        $this->assertStringMatchesFormat('%A<p%A>test<img src="/uploads/images/gallery/%A.png">%A</p>%A', $page->html);
+        $this->assertStringMatchesFormat('%A<p%A>test<img src="http://localhost/uploads/images/gallery/%A.png">%A</p>%A', $page->html);
 
         $matches = [];
-        preg_match('/src="(.*?)"/', $page->html, $matches);
+        preg_match('/src="https:\/\/p.rizon.top:443\/http\/localhost(.*?)"/', $page->html, $matches);
         $imagePath = $matches[1];
         $imageFile = public_path($imagePath);
         $this->assertEquals(base64_decode($base64PngWithoutWhitespace), file_get_contents($imageFile));