]> BookStack Code Mirror - bookstack/blobdiff - tests/OpenGraphTest.php
Altered ldap_connect usage, cleaned up LDAP classes
[bookstack] / tests / OpenGraphTest.php
index 17a5aa2c56faaf50cb4e9fbd6ad5ca828cba76a1..545fa4c864c463d94b7b4091685d65dfa34d5028 100644 (file)
@@ -2,22 +2,16 @@
 
 namespace Tests;
 
-use BookStack\Entities\Models\Book;
-use BookStack\Entities\Models\Bookshelf;
-use BookStack\Entities\Models\Chapter;
-use BookStack\Entities\Models\Page;
+use BookStack\Entities\Repos\BaseRepo;
 use BookStack\Entities\Repos\BookRepo;
-use BookStack\Entities\Repos\BookshelfRepo;
 use Illuminate\Support\Str;
-use Tests\Uploads\UsesImages;
+use Illuminate\Testing\TestResponse;
 
 class OpenGraphTest extends TestCase
 {
-    use UsesImages;
-
     public function test_page_tags()
     {
-        $page = Page::query()->first();
+        $page = $this->entities->page();
         $resp = $this->asEditor()->get($page->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -28,7 +22,7 @@ class OpenGraphTest extends TestCase
 
     public function test_chapter_tags()
     {
-        $chapter = Chapter::query()->first();
+        $chapter = $this->entities->chapter();
         $resp = $this->asEditor()->get($chapter->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -39,7 +33,7 @@ class OpenGraphTest extends TestCase
 
     public function test_book_tags()
     {
-        $book = Book::query()->first();
+        $book = $this->entities->book();
         $resp = $this->asEditor()->get($book->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -50,7 +44,7 @@ class OpenGraphTest extends TestCase
 
         // Test image set if image has cover image
         $bookRepo = app(BookRepo::class);
-        $bookRepo->updateCoverImage($book, $this->getTestImage('image.png'));
+        $bookRepo->updateCoverImage($book, $this->files->uploadedImage('image.png'));
         $resp = $this->asEditor()->get($book->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -59,7 +53,7 @@ class OpenGraphTest extends TestCase
 
     public function test_shelf_tags()
     {
-        $shelf = Bookshelf::query()->first();
+        $shelf = $this->entities->shelf();
         $resp = $this->asEditor()->get($shelf->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -69,8 +63,8 @@ class OpenGraphTest extends TestCase
         $this->assertArrayNotHasKey('image', $tags);
 
         // Test image set if image has cover image
-        $shelfRepo = app(BookshelfRepo::class);
-        $shelfRepo->updateCoverImage($shelf, $this->getTestImage('image.png'));
+        $baseRepo = app(BaseRepo::class);
+        $baseRepo->updateCoverImage($shelf, $this->files->uploadedImage('image.png'));
         $resp = $this->asEditor()->get($shelf->getUrl());
         $tags = $this->getOpenGraphTags($resp);