Add feature tests for domain order management

- Implement AdminDomainOrderTest to cover admin functionalities for domain orders including listing, confirming registration, KYC updates, activation, rejection, and refunds.
- Implement ClientDomainOrderTest to cover client functionalities for placing domain orders, including validation for balance, duplicate orders, and domain normalization.
- Ensure proper handling of domain pricing and service statuses throughout the tests.
This commit is contained in:
baodev0
2026-07-10 14:16:35 +07:00
parent 61c0e026c8
commit dfb926055d
81 changed files with 35743 additions and 481 deletions
@@ -7,9 +7,11 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('ip_pools', function (Blueprint $table) {
$table->softDeletes();
});
if (!Schema::hasColumn('ip_pools', 'deleted_at')) {
Schema::table('ip_pools', function (Blueprint $table) {
$table->softDeletes();
});
}
}
public function down(): void
@@ -9,9 +9,11 @@ use Illuminate\Support\Str;
return new class extends Migration {
public function up(): void
{
Schema::table('ip_pools', function (Blueprint $table) {
$table->uuid('uuid')->nullable()->unique()->after('id');
});
if (!Schema::hasColumn('ip_pools', 'uuid')) {
Schema::table('ip_pools', function (Blueprint $table) {
$table->uuid('uuid')->nullable()->unique()->after('id');
});
}
// Backfill existing rows
DB::table('ip_pools')->whereNull('uuid')->orderBy('id')->each(function ($row) {
@@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
@@ -11,18 +12,25 @@ return new class extends Migration {
public function up(): void
{
Schema::table('ip_pools', function (Blueprint $table) {
$table->string('gateway')->nullable()->after('ip_address');
$table->unsignedTinyInteger('cidr')->default(24)->after('gateway');
$table
->enum('status', ['free', 'assigned', 'reserved'])
->default('free')
->after('module_network_id');
$table->foreignId('service_id')->nullable()->after('status')->constrained('services')->nullOnDelete();
$table->index(['status', 'module_network_id']);
if (!Schema::hasColumn('ip_pools', 'gateway')) {
$table->string('gateway')->nullable()->after('ip_address');
}
if (!Schema::hasColumn('ip_pools', 'cidr')) {
$table->unsignedTinyInteger('cidr')->default(24)->after('gateway');
}
if (!Schema::hasColumn('ip_pools', 'status')) {
$table->enum('status', ['free', 'assigned', 'reserved'])->default('free')->after('module_network_id');
}
if (!Schema::hasColumn('ip_pools', 'service_id')) {
$table->foreignId('service_id')->nullable()->after('status')->constrained('services')->nullOnDelete();
}
});
if (!collect(\DB::select("SHOW INDEX FROM ip_pools WHERE Key_name = 'ip_pools_status_module_network_id_index'"))->count()) {
Schema::table('ip_pools', function (Blueprint $table) {
$table->index(['status', 'module_network_id']);
});
}
}
/**
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('order_items', function (Blueprint $table) {
$table->string('domain_name', 255)->nullable()->after('server_name')->index();
});
}
public function down(): void
{
Schema::table('order_items', function (Blueprint $table) {
$table->dropIndex(['domain_name']);
$table->dropColumn('domain_name');
});
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->string('registrar_reference', 255)->nullable()->after('note');
$table->text('kyc_url')->nullable()->after('registrar_reference');
$table->text('rejection_reason')->nullable()->after('kyc_url');
$table->timestamp('refunded_at')->nullable()->after('rejection_reason');
});
}
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn(['registrar_reference', 'kyc_url', 'rejection_reason', 'refunded_at']);
});
}
};
@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('customers', function (Blueprint $table) {
$table->string('email_verify_code', 6)->nullable()->after('email_verify');
$table->timestamp('email_verify_code_expired_at')->nullable()->after('email_verify_code');
});
}
public function down(): void
{
Schema::table('customers', function (Blueprint $table) {
$table->dropColumn(['email_verify_code', 'email_verify_code_expired_at']);
});
}
};