]> BookStack Code Mirror - bookstack/commitdiff
Fixed failing tests due to shelf text changes, applied styleci changes
authorDan Brown <redacted>
Fri, 2 Sep 2022 13:47:44 +0000 (14:47 +0100)
committerDan Brown <redacted>
Fri, 2 Sep 2022 13:47:44 +0000 (14:47 +0100)
app/Uploads/ImageService.php
tests/Entity/BookShelfTest.php
tests/Entity/PageDraftTest.php
tests/Permissions/EntityPermissionsTest.php

index ec2f6da548cc0dbd53e30e696e34c78abc9f6a0e..7b8af3b84846e7d8abaf625c6f29fd0ccbbd5f65 100644 (file)
@@ -561,9 +561,10 @@ class ImageService
         }
 
         // Strip thumbnail element from path if existing
-        $originalPathSplit = array_filter(explode('/', $path), function(string $part) {
+        $originalPathSplit = array_filter(explode('/', $path), function (string $part) {
             $resizedDir = (strpos($part, 'thumbs-') === 0 || strpos($part, 'scaled-') === 0);
             $missingExtension = strpos($part, '.') === false;
+
             return !($resizedDir && $missingExtension);
         });
 
index 44d30a548a062ac9559aef2e552761d34fa61c47..4461c04899c0774eacd3dda91480ffc79e32321d 100644 (file)
@@ -203,7 +203,7 @@ class BookShelfTest extends TestCase
     {
         $shelf = Bookshelf::first();
         $resp = $this->asEditor()->get($shelf->getUrl('/edit'));
-        $resp->assertSeeText('Edit Bookshelf');
+        $resp->assertSeeText('Edit Shelf');
 
         $booksToInclude = Book::take(2)->get();
         $shelfInfo = [
@@ -270,7 +270,7 @@ class BookShelfTest extends TestCase
         $bookCount = $shelf->books()->count();
 
         $deleteViewReq = $this->asEditor()->get($shelf->getUrl('/delete'));
-        $deleteViewReq->assertSeeText('Are you sure you want to delete this bookshelf?');
+        $deleteViewReq->assertSeeText('Are you sure you want to delete this shelf?');
 
         $deleteReq = $this->delete($shelf->getUrl());
         $deleteReq->assertRedirect(url('/shelves'));
@@ -283,7 +283,7 @@ class BookShelfTest extends TestCase
         $this->assertTrue($shelf->deletions()->count() === 1);
 
         $redirectReq = $this->get($deleteReq->baseResponse->headers->get('location'));
-        $this->assertNotificationContains($redirectReq, 'Bookshelf Successfully Deleted');
+        $this->assertNotificationContains($redirectReq, 'Shelf Successfully Deleted');
     }
 
     public function test_shelf_copy_permissions()
@@ -313,7 +313,7 @@ class BookShelfTest extends TestCase
     {
         $shelf = Bookshelf::first();
         $resp = $this->asAdmin()->get($shelf->getUrl('/permissions'));
-        $resp->assertSeeText('Permissions on bookshelves do not automatically cascade to contained books.');
+        $resp->assertSeeText('Permissions on shelves do not automatically cascade to contained books.');
     }
 
     public function test_bookshelves_show_in_breadcrumbs_if_in_context()
index 6fd9a7f7017ebd13a13a68413ecb8e3563cf8bc1..8ca73847af51388bc4f1d0c2738edddb68953294 100644 (file)
@@ -215,7 +215,7 @@ class PageDraftTest extends TestCase
 
         $this->put('/ajax/page/' . $draft->id . '/save-draft', [
             'name'     => 'My page',
-            'markdown' => "Update test",
+            'markdown' => 'Update test',
         ])->assertOk();
 
         $draft->refresh();
@@ -223,7 +223,7 @@ class PageDraftTest extends TestCase
 
         $this->post($draft->getUrl(), [
             'name'     => 'My page',
-            'markdown' => "# My markdown page"
+            'markdown' => '# My markdown page',
         ]);
 
         $this->assertDatabaseHas('pages', [
index 94863cd5bc702e47cee5459bef46c9d73037322a..ed037d3ac53c990fb7e7ab926cb761e4edda06ef 100644 (file)
@@ -51,7 +51,7 @@ class EntityPermissionsTest extends TestCase
         $this->setRestrictionsForTestRoles($shelf, []);
 
         $this->followingRedirects()->get($shelf->getUrl())
-            ->assertSee('Bookshelf not found');
+            ->assertSee('Shelf not found');
 
         $this->setRestrictionsForTestRoles($shelf, ['view']);
 
@@ -66,7 +66,7 @@ class EntityPermissionsTest extends TestCase
 
         $this->actingAs($this->user)
             ->get($shelf->getUrl('/edit'))
-            ->assertSee('Edit Book');
+            ->assertSee('Edit Shelf');
 
         $this->setRestrictionsForTestRoles($shelf, ['view', 'delete']);
 
@@ -87,7 +87,7 @@ class EntityPermissionsTest extends TestCase
 
         $this->actingAs($this->user)
             ->get($shelf->getUrl('/delete'))
-            ->assertSee('Delete Book');
+            ->assertSee('Delete Shelf');
 
         $this->setRestrictionsForTestRoles($shelf, ['view', 'update']);
 
@@ -98,7 +98,7 @@ class EntityPermissionsTest extends TestCase
 
         $this->get($shelf->getUrl('/delete'))
             ->assertOk()
-            ->assertSee('Delete Book');
+            ->assertSee('Delete Shelf');
     }
 
     public function test_book_view_restriction()
@@ -416,7 +416,7 @@ class EntityPermissionsTest extends TestCase
 
     public function test_bookshelf_restriction_form()
     {
-        $this->entityRestrictionFormTest(Bookshelf::class, 'Bookshelf Permissions', 'view', '2');
+        $this->entityRestrictionFormTest(Bookshelf::class, 'Shelf Permissions', 'view', '2');
     }
 
     public function test_book_restriction_form()
@@ -524,7 +524,7 @@ class EntityPermissionsTest extends TestCase
 
         $this->setRestrictionsForTestRoles($shelf, ['view', 'delete']);
 
-        $this->get($shelf->getUrl('/delete'))->assertOk()->assertSee('Delete Book');
+        $this->get($shelf->getUrl('/delete'))->assertOk()->assertSee('Delete Shelf');
     }
 
     public function test_book_create_restriction_override()