-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegisterUserTest.php.php
More file actions
39 lines (34 loc) · 1.08 KB
/
RegisterUserTest.php.php
File metadata and controls
39 lines (34 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace Tests\Feature\Api;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class RegisterUserTest extends TestCase
{
/**
* A basic feature test example.
*
* @return void
*/
public function testFailedRegisterUser()
{
// When the Parameter is null, response this errorMessages.
$this->json('POST', 'api/RegisterUser')
->assertStatus(401)
->assertJson([
"message" => "Bad Request...",
"errors" => [
'address' => ["The email field is required."],
'password' => ["The password field is required."],
'age' => ["The age filed is required."],
'sex' => ["The sex filed is required."],
]
]);
// Success registerUser at here.
$this->json('POST', 'api/RegisterUser')
->assertStatus(201)
->assertJson([
"message" => "User was created successfully",
]);
}
}