]> BookStack Code Mirror - bookstack/blobdiff - tests/OpenGraphTest.php
Added more complexity in an attempt to make ldap host failover fit
[bookstack] / tests / OpenGraphTest.php
index 653f2e57e27e21d6b34af73de86f38d07d215c30..d6f535718f01ad9f160d17c275cd5ac9b053fca9 100644 (file)
@@ -1,12 +1,11 @@
-<?php namespace Tests;
+<?php
 
-use BookStack\Entities\Models\Book;
-use BookStack\Entities\Models\Bookshelf;
-use BookStack\Entities\Models\Chapter;
-use BookStack\Entities\Models\Page;
+namespace Tests;
+
+use BookStack\Entities\Repos\BaseRepo;
 use BookStack\Entities\Repos\BookRepo;
-use BookStack\Entities\Repos\BookshelfRepo;
 use Illuminate\Support\Str;
+use Illuminate\Testing\TestResponse;
 use Tests\Uploads\UsesImages;
 
 class OpenGraphTest extends TestCase
@@ -15,7 +14,7 @@ class OpenGraphTest extends TestCase
 
     public function test_page_tags()
     {
-        $page = Page::query()->first();
+        $page = $this->entities->page();
         $resp = $this->asEditor()->get($page->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -26,7 +25,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);
 
@@ -37,7 +36,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);
 
@@ -57,7 +56,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);
 
@@ -67,8 +66,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->getTestImage('image.png'));
         $resp = $this->asEditor()->get($shelf->getUrl());
         $tags = $this->getOpenGraphTags($resp);
 
@@ -97,6 +96,4 @@ class OpenGraphTest extends TestCase
 
         return $tags;
     }
-
-
-}
\ No newline at end of file
+}