This commit is contained in:
antv
2026-07-15 10:04:06 +07:00
parent ce6c4d2cf3
commit 866d46bf21
7 changed files with 222 additions and 60 deletions
+24
View File
@@ -19,6 +19,7 @@ class SendThankCardTest extends TestCase
protected function setUp(): void
{
parent::setUp();
\Illuminate\Support\Facades\Http::fake();
$this->userService = $this->app->make(UserServiceInterface::class);
// Create sender and receiver
@@ -92,4 +93,27 @@ class SendThankCardTest extends TestCase
$this->sender->refresh();
$this->assertEquals(8, $this->sender->card);
}
public function test_controller_validation_fails_returns_correct_json_format(): void
{
$this->actingAs($this->sender);
$response = $this->postJson(route('user.store_send'), [
'receiver' => '',
'amount' => 999,
]);
$response->assertStatus(422);
$response->assertJson([
'success' => false,
]);
$response->assertJsonStructure([
'success',
'errors' => [
'receiver',
'amount',
]
]);
}
}