Simplify recipient emails and add live upload progress on create.
Deploy Ladill Transfer / deploy (push) Successful in 47s
Deploy Ladill Transfer / deploy (push) Successful in 47s
Recipients always get the download link immediately when an email is set. Large files upload in the background with per-file and overall progress bars. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,10 +2,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Transfer;
|
||||
use App\Models\User;
|
||||
use App\Notifications\TransferRecipientNotification;
|
||||
use App\Services\Transfer\TransferRecipientMailService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
@@ -19,22 +16,17 @@ class TransferRecipientMailTest extends TestCase
|
||||
use FakesTransferBilling;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_create_transfer_emails_recipient_when_created_milestone_selected(): void
|
||||
public function test_create_transfer_emails_recipient_immediately(): void
|
||||
{
|
||||
Notification::fake();
|
||||
Storage::fake('qr');
|
||||
$this->fakeTransferBillingApi();
|
||||
|
||||
$user = User::create([
|
||||
'public_id' => (string) Str::uuid(),
|
||||
'name' => 'Sender',
|
||||
'email' => 'sender+'.uniqid().'@example.com',
|
||||
]);
|
||||
$user = $this->makeUser();
|
||||
|
||||
$this->actingAs($user)->post(route('transfer.transfers.store'), [
|
||||
'title' => 'Project files',
|
||||
'recipient_email' => 'recipient@example.com',
|
||||
'email_milestones' => ['created'],
|
||||
'files' => [UploadedFile::fake()->create('brief.pdf', 100, 'application/pdf')],
|
||||
])->assertRedirect();
|
||||
|
||||
@@ -44,35 +36,28 @@ class TransferRecipientMailTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function test_recipient_day_milestone_is_sent_once(): void
|
||||
public function test_create_transfer_without_recipient_email_sends_no_notification(): void
|
||||
{
|
||||
Notification::fake();
|
||||
Storage::fake('qr');
|
||||
$this->fakeTransferBillingApi();
|
||||
|
||||
$user = User::create([
|
||||
$user = $this->makeUser();
|
||||
|
||||
$this->actingAs($user)->post(route('transfer.transfers.store'), [
|
||||
'title' => 'Project files',
|
||||
'files' => [UploadedFile::fake()->create('brief.pdf', 100, 'application/pdf')],
|
||||
])->assertRedirect();
|
||||
|
||||
Notification::assertNothingSent();
|
||||
}
|
||||
|
||||
private function makeUser()
|
||||
{
|
||||
return \App\Models\User::create([
|
||||
'public_id' => (string) Str::uuid(),
|
||||
'name' => 'Sender',
|
||||
'email' => 'sender+'.uniqid().'@example.com',
|
||||
]);
|
||||
|
||||
$transfer = Transfer::create([
|
||||
'user_id' => $user->id,
|
||||
'title' => 'Reminder test',
|
||||
'recipient_email' => 'recipient@example.com',
|
||||
'recipient_email_milestones' => ['7'],
|
||||
'recipient_milestones_sent' => [],
|
||||
'retention_days' => 30,
|
||||
'paid_until' => now()->addDays(7)->startOfDay(),
|
||||
'status' => Transfer::STATUS_ACTIVE,
|
||||
'storage_bytes' => 1024,
|
||||
]);
|
||||
|
||||
$service = app(TransferRecipientMailService::class);
|
||||
$this->assertSame(1, $service->processDueMilestones());
|
||||
$this->assertSame(0, $service->processDueMilestones());
|
||||
|
||||
$transfer->refresh();
|
||||
$this->assertContains('7', $transfer->recipient_milestones_sent ?? []);
|
||||
|
||||
Notification::assertSentOnDemand(TransferRecipientNotification::class, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user