Files
shopit-back/tests/Feature/Purchase/PurchaseExpiredExceptionResponseTest.php

25 lines
697 B
PHP

<?php
namespace Tests\Feature\Purchase;
use App\Domains\Purchase\Exceptions\PurchaseExpiredException;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;
class PurchaseExpiredExceptionResponseTest extends TestCase
{
public function test_it_returns_a_stable_api_error_for_an_expired_purchase(): void
{
Route::get('/api/test/purchase-expired', function (): never {
throw new PurchaseExpiredException;
});
$this->getJson('/api/test/purchase-expired')
->assertUnprocessable()
->assertExactJson([
'code' => 'purchase.expired',
'message' => __('api.purchase.expired'),
]);
}
}