Initialer Laravel Commit für BetiX
This commit is contained in:
32
tests/Feature/Gateway/WalletControllerTest.php
Normal file
32
tests/Feature/Gateway/WalletControllerTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user