mirror of https://github.com/hasinhayder/hydra
parent
4b1c10bf7c
commit
17612db14a
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminLoginFailTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic feature test example.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function test_example()
|
||||||
|
{
|
||||||
|
$response = $this->postJson('/api/login',[
|
||||||
|
'email'=>'admin@hydra.project',
|
||||||
|
'password'=>'hydrax'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response
|
||||||
|
->assertJson(fn (AssertableJson $json) =>
|
||||||
|
$json->where('error', 1)
|
||||||
|
->missing('token')
|
||||||
|
->has('message')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminLoginTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic feature test example.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function test_example()
|
||||||
|
{
|
||||||
|
$response = $this->postJson('/api/login',[
|
||||||
|
'email'=>'admin@hydra.project',
|
||||||
|
'password'=>'hydra'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response
|
||||||
|
->assertJson(fn (AssertableJson $json) =>
|
||||||
|
$json->where('error', 0)
|
||||||
|
->has('token')
|
||||||
|
->etc()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class HelloHydraTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic feature test example.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function test_hello_hydra()
|
||||||
|
{
|
||||||
|
$response = $this->get('/api/hydra');
|
||||||
|
|
||||||
|
$response
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertJson([
|
||||||
|
'message' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_hydra_version()
|
||||||
|
{
|
||||||
|
$response = $this->get('/api/hydra/version');
|
||||||
|
|
||||||
|
$response
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertJson([
|
||||||
|
'message' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue