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

This commit is contained in:
Dan Brown 2022-09-02 14:47:44 +01:00
parent 5736919836
commit 7f8b3eff5a
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 14 additions and 13 deletions

View 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);
});

View 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()

View 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', [

View 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()