From 7605a826d6b0fdb72ef25d219ec2f3b3d4fd82d6 Mon Sep 17 00:00:00 2001 From: James Collins Date: Mon, 13 Mar 2023 13:06:59 +1000 Subject: [PATCH] added test --- tests/Feature/ContactFormTest.php | 28 ++++++++++++++++++++++++++++ tests/Feature/ExampleTest.php | 21 --------------------- 2 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 tests/Feature/ContactFormTest.php delete mode 100644 tests/Feature/ExampleTest.php diff --git a/tests/Feature/ContactFormTest.php b/tests/Feature/ContactFormTest.php new file mode 100644 index 0000000..736bcf2 --- /dev/null +++ b/tests/Feature/ContactFormTest.php @@ -0,0 +1,28 @@ + '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); + } +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100644 index 1eafba6..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,21 +0,0 @@ -get('/'); - - $response->assertStatus(200); - } -}