feat(admin): improve payments and server settings
This commit is contained in:
@@ -5,12 +5,17 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature\Api\Transaction;
|
||||
|
||||
use App\Enums\TransactionStatus;
|
||||
use App\Events\AdminNotificationCreated;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ManualDepositProofTest extends TestCase
|
||||
@@ -108,8 +113,13 @@ class ManualDepositProofTest extends TestCase
|
||||
public function test_upload_then_confirm_binds_proof_to_owner(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
Mail::fake();
|
||||
Event::fake([AdminNotificationCreated::class]);
|
||||
|
||||
$customer = Customer::factory()->create();
|
||||
Role::firstOrCreate(['name' => 'Full Administrator', 'guard_name' => 'admin']);
|
||||
$admin = User::factory()->create();
|
||||
$admin->assignRole('Full Administrator');
|
||||
|
||||
$transaction = Transaction::create([
|
||||
'uuid' => Str::uuid()->toString(),
|
||||
@@ -138,5 +148,15 @@ class ManualDepositProofTest extends TestCase
|
||||
|
||||
$confirm->assertStatus(200)->assertJsonPath('error', false);
|
||||
$this->assertSame($path, $transaction->fresh()->proof_image);
|
||||
$this->assertDatabaseHas('notifications', [
|
||||
'recipient_type' => 'admin',
|
||||
'recipient_id' => $admin->id,
|
||||
'type' => 'manual_deposit_pending',
|
||||
'link' => '/transactions',
|
||||
]);
|
||||
Event::assertDispatched(
|
||||
AdminNotificationCreated::class,
|
||||
fn (AdminNotificationCreated $event) => $event->type === 'manual_deposit_pending',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user