]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/BookTest.php
Moved more tests out of EntityTest
[bookstack] / tests / Entity / BookTest.php
index a2d4aee20120d65b5e3cef65bcb9e08560fde941..a3effe779d80d81eb573d00c537b7a55bb941aef 100644 (file)
@@ -119,4 +119,28 @@ class BookTest extends TestCase
         $resp->assertRedirect();
         $this->assertEquals('list', setting()->getUser($editor, 'books_view_type'));
     }
+
+    public function test_slug_multi_byte_url_safe()
+    {
+        $book = $this->newBook([
+            'name' => 'информация',
+        ]);
+
+        $this->assertEquals('informatsiya', $book->slug);
+
+        $book = $this->newBook([
+            'name' => '¿Qué?',
+        ]);
+
+        $this->assertEquals('que', $book->slug);
+    }
+
+    public function test_slug_format()
+    {
+        $book = $this->newBook([
+            'name' => 'PartA / PartB / PartC',
+        ]);
+
+        $this->assertEquals('parta-partb-partc', $book->slug);
+    }
 }