32 lines
875 B
PHP
32 lines
875 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Communication;
|
|
|
|
use App\Services\Communication\CommunicationTemplateService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class CommunicationTemplateServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_list_active_templates_maps_columns(): void
|
|
{
|
|
DB::table('email_templates')->insert([
|
|
'id' => 1,
|
|
'code' => 'welcome',
|
|
'variant' => 'default',
|
|
'subject' => 'Hello',
|
|
'body_html' => 'Body',
|
|
'is_active' => 1,
|
|
]);
|
|
|
|
$service = new CommunicationTemplateService();
|
|
$templates = $service->listActiveTemplates();
|
|
|
|
$this->assertSame('welcome', $templates[0]['template_key']);
|
|
$this->assertSame('Body', $templates[0]['body']);
|
|
}
|
|
}
|