public function test_image_upload()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$imgDetails = $this->uploadGalleryImage($page);
public function test_image_display_thumbnail_generation_does_not_increase_image_size()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$originalFile = $this->getTestImageFilePath('compressed.png');
public function test_image_display_thumbnail_generation_for_apng_images_uses_original_file()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$imgDetails = $this->uploadGalleryImage($page, 'animated.png');
public function test_image_edit()
{
- $editor = $this->getEditor();
+ $editor = $this->users->editor();
$this->actingAs($editor);
$imgDetails = $this->uploadGalleryImage();
public function test_image_usage()
{
$page = $this->entities->page();
- $editor = $this->getEditor();
+ $editor = $this->users->editor();
$this->actingAs($editor);
$imgDetails = $this->uploadGalleryImage($page);
public function test_php_files_cannot_be_uploaded()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$fileName = 'bad.php';
public function test_php_like_files_cannot_be_uploaded()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$fileName = 'bad.phtml';
public function test_files_with_double_extensions_will_get_sanitized()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$fileName = 'bad.phtml.png';
}
}
- public function test_system_images_remain_public()
+ public function test_system_images_remain_public_with_local_secure()
{
config()->set('filesystems.images', 'local_secure');
$this->asAdmin();
}
}
+ public function test_system_images_remain_public_with_local_secure_restricted()
+ {
+ config()->set('filesystems.images', 'local_secure_restricted');
+ $this->asAdmin();
+ $galleryFile = $this->getTestImage('my-system-test-restricted-upload.png');
+ $expectedPath = public_path('uploads/images/system/' . date('Y-m') . '/my-system-test-restricted-upload.png');
+
+ $upload = $this->call('POST', '/settings/customization', [], [], ['app_logo' => $galleryFile], []);
+ $upload->assertRedirect('/settings/customization');
+
+ $this->assertTrue(file_exists($expectedPath), 'Uploaded image not found at path: ' . $expectedPath);
+
+ if (file_exists($expectedPath)) {
+ unlink($expectedPath);
+ }
+ }
+
public function test_secure_restricted_images_inaccessible_without_relation_permission()
{
config()->set('filesystems.images', 'local_secure_restricted');
$this->get($expectedUrl)->assertOk();
- $this->entities->setPermissions($page, [], []);
+ $this->permissions->setEntityPermissions($page, [], []);
$resp = $this->get($expectedUrl);
$resp->assertNotFound();
$this->get($expectedUrl)->assertOk();
- $this->entities->setPermissions($page, [], []);
+ $this->permissions->setEntityPermissions($page, [], []);
$resp = $this->get($expectedUrl);
$resp->assertNotFound();
$export = $this->get($pageB->getUrl('/export/html'));
$this->assertStringContainsString($encodedImageContent, $export->getContent());
- $this->entities->setPermissions($pageA, [], []);
+ $this->permissions->setEntityPermissions($pageA, [], []);
$export = $this->get($pageB->getUrl('/export/html'));
$this->assertStringNotContainsString($encodedImageContent, $export->getContent());
$imageName = 'first-image.png';
$relPath = $this->getTestImagePath('gallery', $imageName);
$this->deleteImage($relPath);
- $viewer = $this->getViewer();
+ $viewer = $this->users->viewer();
$this->uploadImage($imageName, $page->id);
$image = Image::first();
$resp = $this->actingAs($viewer)->get("/images/edit/{$image->id}");
$this->withHtml($resp)->assertElementNotExists('button#image-manager-delete[title="Delete"]');
- $this->giveUserPermissions($viewer, ['image-delete-all']);
+ $this->permissions->grantUserRolePermissions($viewer, ['image-delete-all']);
$resp = $this->actingAs($viewer)->get("/images/edit/{$image->id}");
$this->withHtml($resp)->assertElementExists('button#image-manager-delete[title="Delete"]');
public function test_user_image_upload()
{
- $editor = $this->getEditor();
- $admin = $this->getAdmin();
+ $editor = $this->users->editor();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$file = $this->getTestProfileImage();
public function test_user_images_deleted_on_user_deletion()
{
- $editor = $this->getEditor();
+ $editor = $this->users->editor();
$this->actingAs($editor);
$file = $this->getTestProfileImage();
public function test_deleted_unused_images()
{
$page = $this->entities->page();
- $admin = $this->getAdmin();
+ $admin = $this->users->admin();
$this->actingAs($admin);
$imageName = 'unused-image.png';