Files
BetiX/tests/Feature/Gateway/VaultPinControllerTest.php
Dolo 0280278978
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
Initialer Laravel Commit für BetiX
2026-04-04 18:01:50 +02:00

51 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature\Gateway;
use App\Models\User;
use Illuminate\Support\Facades\Http;
use Tests\TestCase;
class VaultPinControllerTest extends TestCase
{
private function base(): string
{
return rtrim((string) config('services.backend.base'), '/');
}
private function actingUser()
{
return User::factory()->create([
'username' => 'pinuser',
'email_verified_at' => now(),
'vault_pin_hash' => \Illuminate\Support\Facades\Hash::make('4321'),
]);
}
public function test_set_success()
{
$user = $this->actingUser();
// Da ein PIN gesetzt ist, müssen wir current_pin mitsenden
$res = $this->actingAs($user, 'web')
->postJson('/api/wallet/vault/pin/set', [ 'pin' => '1234', 'current_pin' => '4321' ]);
$res->assertStatus(200)
->assertJson([
'success' => true,
]);
}
public function test_verify_success()
{
$user = $this->actingUser();
// Der actingUser() hat PIN 4321
$res = $this->actingAs($user, 'web')
->postJson('/api/wallet/vault/pin/verify', [ 'pin' => '4321' ]);
$res->assertStatus(200)
->assertJson([
'success' => true,
]);
}
}