]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/BookTest.php
Slugs: Fixed storage bugs, added testing coverage
[bookstack] / tests / Entity / BookTest.php
index 51bf65d10bb29d92668fd80bfb1614688cf73c83..545d6b305784bf2c80dc6e772323cbd2535b945a 100644 (file)
@@ -27,7 +27,7 @@ class BookTest extends TestCase
 
         $resp = $this->get('/books/my-first-book');
         $resp->assertSee($book->name);
-        $resp->assertSee($book->description);
+        $resp->assertSee($book->descriptionInfo()->getPlain());
     }
 
     public function test_create_uses_different_slugs_when_name_reused()
@@ -238,30 +238,6 @@ class BookTest extends TestCase
         $this->assertEquals('list', setting()->getUser($editor, 'books_view_type'));
     }
 
-    public function test_slug_multi_byte_url_safe()
-    {
-        $book = $this->entities->newBook([
-            'name' => 'информация',
-        ]);
-
-        $this->assertEquals('informaciia', $book->slug);
-
-        $book = $this->entities->newBook([
-            'name' => '¿Qué?',
-        ]);
-
-        $this->assertEquals('que', $book->slug);
-    }
-
-    public function test_slug_format()
-    {
-        $book = $this->entities->newBook([
-            'name' => 'PartA / PartB / PartC',
-        ]);
-
-        $this->assertEquals('parta-partb-partc', $book->slug);
-    }
-
     public function test_description_limited_to_specific_html()
     {
         $book = $this->entities->book();
@@ -362,12 +338,12 @@ class BookTest extends TestCase
         $coverImageFile = $this->files->uploadedImage('cover.png');
         $bookRepo->updateCoverImage($book, $coverImageFile);
 
-        $this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book']);
+        $this->asEditor()->post($book->getUrl('/copy'), ['name' => 'My copy book'])->assertRedirect();
         /** @var Book $copy */
         $copy = Book::query()->where('name', '=', 'My copy book')->first();
 
-        $this->assertNotNull($copy->cover);
-        $this->assertNotEquals($book->cover->id, $copy->cover->id);
+        $this->assertNotNull($copy->coverInfo()->getImage());
+        $this->assertNotEquals($book->coverInfo()->getImage()->id, $copy->coverInfo()->getImage()->id);
     }
 
     public function test_copy_adds_book_to_shelves_if_edit_permissions_allows()