added test
This commit is contained in:
28
tests/Feature/ContactFormTest.php
Normal file
28
tests/Feature/ContactFormTest.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ContactFormTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function testContactForm()
|
||||||
|
{
|
||||||
|
$formData = [
|
||||||
|
'name' => 'John Doe',
|
||||||
|
'email' => 'johndoe@example.com',
|
||||||
|
'content' => 'Hello, this is a test message.',
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->postJson('/api/contact', $formData);
|
||||||
|
$response->assertStatus(201);
|
||||||
|
|
||||||
|
$formData = [
|
||||||
|
'name' => 'John Doe',
|
||||||
|
'content' => 'Hello, this is a test message.',
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->postJson('/api/contact', $formData);
|
||||||
|
$response->assertStatus(422);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
// use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function test_the_application_returns_a_successful_response()
|
|
||||||
{
|
|
||||||
$response = $this->get('/');
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user