-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminTest.php
More file actions
52 lines (44 loc) · 1.31 KB
/
AdminTest.php
File metadata and controls
52 lines (44 loc) · 1.31 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
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Tests\Feature\Api;
use App\Models\Api\Admin;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Hash;
use Tests\TestCase;
use Illuminate\Testing\Fluent\AssertableJson;
class AdminTest extends TestCase
{
/**
* A basic feature test example.
*
* @return void
*/
public function testFailedLogin ()
{
Admin::create([
'nick_name' => 'test1234',
'address'=>'test1234@com',
'password' => bcrypt('secret123$'),
'age' => '30',
'sex' => '1'
]);
$data = [
'email' => '',
'password' => 'secret123$',
];
//attempt login
$response = $this->json('POST', redirect('http://127.0.0.1:8000/api/login'), $data);
//Assert it was successful and a token was received
$response->assertStatus(404);
}
// public function testLoginSuccess()
// {
// // When the Parameter is null, response this errorMessages.
// $response = $this->postJson('/api/login', ['email' => ''], ['password' => Hash::make('test1234')]);
// $response
// ->assertStatus(401)
// ->assertJson([
// 'created' => false,
// ]);
// }
}