mirror of https://github.com/hasinhayder/hydra
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
942 B
40 lines
942 B
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Testing\Fluent\AssertableJson;
|
|
use Tests\TestCase;
|
|
|
|
class AdminLoginTest extends TestCase {
|
|
/**
|
|
* A basic feature test example.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function test_admin_login() {
|
|
$response = $this->postJson('/api/login', [
|
|
'email'=>'admin@hydra.project',
|
|
'password'=>'hydra',
|
|
]);
|
|
|
|
$response
|
|
->assertJson(fn (AssertableJson $json) => $json->where('error', 0)
|
|
->has('token')
|
|
->etc()
|
|
);
|
|
}
|
|
|
|
public function test_admin_login_fail() {
|
|
$response = $this->postJson('/api/login', [
|
|
'email'=>'admin@hydra.project',
|
|
'password'=>'hydrax',
|
|
]);
|
|
|
|
$response
|
|
->assertJson(fn (AssertableJson $json) => $json->where('error', 1)
|
|
->missing('token')
|
|
->has('message')
|
|
);
|
|
}
|
|
}
|