]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/EntityTest.php
Adds code to allow deletion of users via cmd line.
[bookstack] / tests / Entity / EntityTest.php
index 647676ec75772d5b47b5a9e2e035db493cb29f93..a43f65b5efd568c58d1ce6a8e9c9343276d1be07 100644 (file)
@@ -11,7 +11,6 @@ class EntityTest extends BrowserKitTest
 
     public function test_entity_creation()
     {
-
         // Test Creation
         $book = $this->bookCreation();
         $chapter = $this->chapterCreation($book);
@@ -145,27 +144,16 @@ class EntityTest extends BrowserKitTest
             // Fill out form & save
             ->type($book->name, '#name')
             ->type($book->description, '#description')
-            ->press('Select Image')
-            ->click('test-image.jpg')
-            ->press('Select Image')
             ->press('Save Book')
             // Check it redirects correctly
             ->seePageIs('/books/my-first-book')
             ->see($book->name)->see($book->description);
 
-        $book = factory(Book::class)->latest();
-        $this->assertDatabaseHas('images', [
-        'id' => $book->image
-        ]);
-
         // Ensure duplicate names are given different slugs
         $this->asAdmin()
             ->visit('/books/create')
             ->type($book->name, '#name')
             ->type($book->description, '#description')
-            ->press('Select Image')
-            ->click('test-image.jpg')
-            ->press('Select Image')
             ->press('Save Book');
         
         $expectedPattern = '/\/books\/my-first-book-[0-9a-zA-Z]{3}/';
@@ -268,11 +256,25 @@ class EntityTest extends BrowserKitTest
             ->seeInElement('#recently-updated-pages', $page->name);
     }
 
-    public function test_recently_created_pages_on_home()
+    public function test_slug_multi_byte_lower_casing()
     {
-        $entityChain = $this->createEntityChainBelongingToUser($this->getEditor());
-        $this->asAdmin()->visit('/')
-            ->seeInElement('#recently-created-pages', $entityChain['page']->name);
+        $entityRepo = app(EntityRepo::class);
+        $book = $entityRepo->createFromInput('book', [
+            'name' => 'КНИГА'
+        ]);
+
+        $this->assertEquals('книга', $book->slug);
+    }
+
+
+    public function test_slug_format()
+    {
+        $entityRepo = app(EntityRepo::class);
+        $book = $entityRepo->createFromInput('book', [
+            'name' => 'PartA / PartB / PartC'
+        ]);
+
+        $this->assertEquals('parta-partb-partc', $book->slug);
     }
 
 }