['webmail' => 'test-webmail-key'], 'identity.api_url' => 'https://ladill.com/api', 'identity.api_key' => 'test-identity-key', ]); } public function test_webmail_service_can_create_transfer_for_mailbox(): void { Http::fake([ rtrim((string) config('identity.api_url'), '/').'/identity/profile*' => Http::response([ 'data' => [ 'public_id' => (string) Str::uuid(), 'name' => 'Mail User', 'email' => 'sender@acme.com', 'picture' => null, ], ]), ]); $file = UploadedFile::fake()->create('large.zip', 30000, 'application/zip'); $this->withToken('test-webmail-key') ->post('/api/v1/transfers', [ 'mailbox' => 'sender@acme.com', 'title' => 'Email: Quarterly report', 'files' => [$file], ]) ->assertCreated() ->assertJsonPath('data.title', 'Email: Quarterly report') ->assertJsonStructure(['data' => ['public_url', 'files']]); $this->assertDatabaseHas('users', ['email' => 'sender@acme.com']); $this->assertDatabaseCount('transfers', 1); } public function test_transfer_api_rejects_unauthorized_callers(): void { $this->post('/api/v1/transfers', ['mailbox' => 'x@y.com']) ->assertUnauthorized(); } }