]> BookStack Code Mirror - bookstack/blobdiff - tests/ImageTest.php
#47 - Fixes the issues with the test case.
[bookstack] / tests / ImageTest.php
index 23373419f21792413a97706aee439787c13dc6aa..3bb41138bae7d50dd8d9821fed27bf0ad54ebad0 100644 (file)
@@ -1,6 +1,6 @@
-<?php
+<?php namespace Tests;
 
-class ImageTest extends TestCase
+class ImageTest extends BrowserKitTest
 {
 
     /**
@@ -10,7 +10,7 @@ class ImageTest extends TestCase
      */
     protected function getTestImage($fileName)
     {
-        return new \Illuminate\Http\UploadedFile(base_path('tests/test-image.jpg'), $fileName, 'image/jpeg', 5238);
+        return new \Illuminate\Http\UploadedFile(base_path('tests/test-data/test-image.jpg'), $fileName, 'image/jpeg', 5238);
     }
 
     /**
@@ -62,7 +62,7 @@ class ImageTest extends TestCase
         $this->deleteImage($relPath);
 
         $this->seeInDatabase('images', [
-            'url' => url($relPath),
+            'url' => $this->baseUrl . $relPath,
             'type' => 'gallery',
             'uploaded_to' => $page->id,
             'path' => $relPath,
@@ -86,11 +86,11 @@ class ImageTest extends TestCase
         $this->assertResponseOk();
 
         $this->dontSeeInDatabase('images', [
-            'url' => $relPath,
+            'url' => $this->baseUrl . $relPath,
             'type' => 'gallery'
         ]);
 
-        $this->assertFalse(file_exists(public_path($relPath)), 'Uploaded image has been deleted');
+        $this->assertFalse(file_exists(public_path($relPath)), 'Uploaded image has not been deleted as expected');
     }
 
 }
\ No newline at end of file