33 lines
983 B
PHP
33 lines
983 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Gateway;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Tests\TestCase;
|
|
|
|
class WalletControllerTest extends TestCase
|
|
{
|
|
private function base(): string { return rtrim((string) config('services.backend.base'), '/'); }
|
|
|
|
private function actingUser()
|
|
{
|
|
if (class_exists(User::class) && method_exists(User::class, 'factory')) {
|
|
return User::factory()->make(['id' => 901, 'username' => 'walletuser']);
|
|
}
|
|
return new class { public $id=901; public $username='walletuser'; public $role='User'; };
|
|
}
|
|
|
|
public function test_index_renders_with_upstream_data()
|
|
{
|
|
Http::fake([
|
|
$this->base() . '/wallet' => Http::response([
|
|
'wallets' => [ ['code' => 'USD', 'balance' => 10] ],
|
|
'btxBalance' => 10,
|
|
], 200),
|
|
]);
|
|
$res = $this->actingAs($this->actingUser())->get('/wallet');
|
|
$res->assertStatus(200);
|
|
}
|
|
}
|