<?php

namespace App\Tests\Exception;

use App\Exception\VaultException;
use PHPUnit\Framework\TestCase;

class VaultExceptionTest extends TestCase
{
    public function testHttpError(): void
    {
        $e = VaultException::httpError(500, 'Internal error');
        $this->assertInstanceOf(VaultException::class, $e);
        $this->assertInstanceOf(\RuntimeException::class, $e);
        $this->assertStringContainsString('500', $e->getMessage());
        $this->assertStringContainsString('Internal error', $e->getMessage());
    }

    public function testHttpErrorWithDifferentCode(): void
    {
        $e = VaultException::httpError(403, 'Forbidden');
        $this->assertStringContainsString('403', $e->getMessage());
        $this->assertStringContainsString('Forbidden', $e->getMessage());
    }
}
