- Lịch sử thanh toán hoá đơn trả thêm `method` (tự động gia hạn / số dư / admin / chuyển khoản / hoàn tiền), bỏ đuôi `(method)` khỏi ghi chú - `DnsServer::panelUrl()` = https://<domain>/ dùng cho email cấp hosting và nút Plesk của khách - Order item trả thêm `uuid`/`type` của dịch vụ để FE dẫn tới trang quản lý - Yêu cầu huỷ dịch vụ, chứng chỉ SSL, lịch sử gia hạn, đổi mật khẩu hosting cho khách Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
32 lines
1.2 KiB
PHP
32 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Product;
|
|
use App\Support\ServiceGroup;
|
|
use Tests\TestCase;
|
|
|
|
class ServiceGroupTest extends TestCase
|
|
{
|
|
public function test_of_classifies_by_type_then_name(): void
|
|
{
|
|
$this->assertSame('email', ServiceGroup::of('email', 'Email Business'));
|
|
$this->assertSame('ssl', ServiceGroup::of('ssl', 'Whatever'));
|
|
$this->assertSame('ssl', ServiceGroup::of('other', 'SSL - Positive'));
|
|
$this->assertSame('colo', ServiceGroup::of('other', 'COLO VNPT STAR'));
|
|
$this->assertSame('colo', ServiceGroup::of('server_rental', 'Chỗ đặt 1U'));
|
|
$this->assertSame('dedicated', ServiceGroup::of('other', 'DEDICATED GOLD'));
|
|
$this->assertSame('dedicated', ServiceGroup::of('server_rental', 'Máy chủ X'));
|
|
$this->assertNull(ServiceGroup::of('other', 'Khác'));
|
|
$this->assertNull(ServiceGroup::of('vps', 'colo vps'));
|
|
}
|
|
|
|
public function test_constrain_sql_matches_of(): void
|
|
{
|
|
foreach (ServiceGroup::ALL as $group) {
|
|
$sql = ServiceGroup::constrain(Product::query(), $group)->toSql();
|
|
$this->assertStringContainsString('product_type', $sql, $group);
|
|
}
|
|
}
|
|
}
|