Skip to content

NOW MANAGED ON CODEBERG

Fixed failing tests due to shelf text changes, applied styleci changes

Dan Brown7f8b3eff5a82
diff --git a/app/Uploads/ImageService.php b/app/Uploads/ImageService.php
index ec2f6da54..7b8af3b84 100644
--- a/app/Uploads/ImageService.php
+++ b/app/Uploads/ImageService.php
@@ -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);
});
diff --git a/tests/Entity/BookShelfTest.php b/tests/Entity/BookShelfTest.php
index 44d30a548..4461c0489 100644
--- a/tests/Entity/BookShelfTest.php
+++ b/tests/Entity/BookShelfTest.php
@@ -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()
diff --git a/tests/Entity/PageDraftTest.php b/tests/Entity/PageDraftTest.php
index 6fd9a7f70..8ca73847a 100644
--- a/tests/Entity/PageDraftTest.php
+++ b/tests/Entity/PageDraftTest.php
@@ -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', [
diff --git a/tests/Permissions/EntityPermissionsTest.php b/tests/Permissions/EntityPermissionsTest.php
index 94863cd5b..ed037d3ac 100644
--- a/tests/Permissions/EntityPermissionsTest.php
+++ b/tests/Permissions/EntityPermissionsTest.php
@@ -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()