37 lines
1018 B
PHP
37 lines
1018 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Requests\Client;
|
|
|
|
use App\Http\Requests\Client\PaymentRequest;
|
|
use App\Models\Invoice;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\Concerns\ValidatesFormRequests;
|
|
use Tests\TestCase;
|
|
|
|
class PaymentRequestTest extends TestCase
|
|
{
|
|
use RefreshDatabase, ValidatesFormRequests;
|
|
|
|
public function test_passes_with_existing_invoice_id(): void
|
|
{
|
|
$invoice = Invoice::factory()->create();
|
|
|
|
$this->assertPasses(PaymentRequest::class, ['invoice_id' => $invoice->id]);
|
|
}
|
|
|
|
public function test_fails_without_invoice_id(): void
|
|
{
|
|
$this->assertFailsOn('invoice_id', PaymentRequest::class, []);
|
|
}
|
|
|
|
public function test_fails_with_non_integer_invoice_id(): void
|
|
{
|
|
$this->assertFailsOn('invoice_id', PaymentRequest::class, ['invoice_id' => 'abc']);
|
|
}
|
|
|
|
public function test_fails_with_unknown_invoice_id(): void
|
|
{
|
|
$this->assertFailsOn('invoice_id', PaymentRequest::class, ['invoice_id' => 999]);
|
|
}
|
|
}
|