- Star (is_starred) and colored tags for services, customers, orders, invoices:
Markable trait, tags/taggables tables, PATCH administrator/marks/{type}/{key},
tag CRUD, list filters starred / tag_ids[]
- GET administrator/services accepts product_type (falls back to product type
for legacy rows without services.type)
- Mail campaigns: bulk cancel / retry failed / delete; cancelled campaigns are
skipped by SendMailCampaignRecipient
- POST administrator/settings/test-smtp sends a test email through the saved
mail transport
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Api\Admin\Setting;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Spatie\Permission\Models\Role;
|
|
use Tests\TestCase;
|
|
|
|
class SmtpTestMailTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
private function admin(): User
|
|
{
|
|
Role::firstOrCreate(['name' => 'Full Administrator', 'guard_name' => 'admin']);
|
|
$admin = User::factory()->create();
|
|
$admin->assignRole('Full Administrator');
|
|
|
|
return $admin;
|
|
}
|
|
|
|
public function test_sends_test_email_to_given_address(): void
|
|
{
|
|
$this->actingAs($this->admin(), 'admin')
|
|
->postJson('/api/v1/administrator/settings/test-smtp', ['email' => 'ops@example.com'])
|
|
->assertOk();
|
|
|
|
$messages = app('mail.manager')->mailer('array')->getSymfonyTransport()->messages();
|
|
$this->assertCount(1, $messages);
|
|
$this->assertSame('ops@example.com', $messages->first()->getEnvelope()->getRecipients()[0]->getAddress());
|
|
}
|
|
|
|
public function test_rejects_invalid_address(): void
|
|
{
|
|
$this->actingAs($this->admin(), 'admin')
|
|
->postJson('/api/v1/administrator/settings/test-smtp', ['email' => 'not-an-email'])
|
|
->assertUnprocessable();
|
|
}
|
|
}
|