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>
64 lines
1.9 KiB
PHP
64 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Notifications\TransferRecipientNotification;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Facades\Notification;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Str;
|
|
use Tests\Concerns\FakesTransferBilling;
|
|
use Tests\TestCase;
|
|
|
|
class TransferRecipientMailTest extends TestCase
|
|
{
|
|
use FakesTransferBilling;
|
|
use RefreshDatabase;
|
|
|
|
public function test_create_transfer_emails_recipient_immediately(): void
|
|
{
|
|
Notification::fake();
|
|
Storage::fake('qr');
|
|
$this->fakeTransferBillingApi();
|
|
|
|
$user = $this->makeUser();
|
|
|
|
$this->actingAs($user)->post(route('transfer.transfers.store'), [
|
|
'title' => 'Project files',
|
|
'recipient_email' => 'recipient@example.com',
|
|
'files' => [UploadedFile::fake()->create('brief.pdf', 100, 'application/pdf')],
|
|
])->assertRedirect();
|
|
|
|
Notification::assertSentOnDemand(
|
|
TransferRecipientNotification::class,
|
|
fn ($notification, $channels, $notifiable) => $notifiable->routes['mail'] === 'recipient@example.com',
|
|
);
|
|
}
|
|
|
|
public function test_create_transfer_without_recipient_email_sends_no_notification(): void
|
|
{
|
|
Notification::fake();
|
|
Storage::fake('qr');
|
|
$this->fakeTransferBillingApi();
|
|
|
|
$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',
|
|
]);
|
|
}
|
|
}
|