feature tests
This commit is contained in:
parent
54c8053323
commit
7b3854eb17
19
api/tests/Feature/ProductsTest.php
Normal file
19
api/tests/Feature/ProductsTest.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ProductsTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function testGetProducts()
|
||||||
|
{
|
||||||
|
$response = $this->get('http://localhost:8000/api/product');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJsonStructure(['success', 'data' => ['products']]);
|
||||||
|
}
|
||||||
|
}
|
19
api/tests/Feature/RecipesTest.php
Normal file
19
api/tests/Feature/RecipesTest.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class RecipesTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function testGetRecipes()
|
||||||
|
{
|
||||||
|
$response = $this->get('http://localhost:8000/api/recipe');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJsonStructure(['success', 'data' => ['recipes']]);
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,9 @@ class UsersTest extends TestCase
|
|||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
private array $loginData = ['email' => 'artur.nowakowski@gmail.com', 'password' => 'test123'];
|
protected $loginData = ['email' => 'artur.nowakowski@gmail.com', 'password' => 'test123'];
|
||||||
|
|
||||||
public function getToken()
|
protected function getToken()
|
||||||
{
|
{
|
||||||
$response = $this->post('http://localhost:8000/api/user/login', $this->loginData)->decodeResponseJson();
|
$response = $this->post('http://localhost:8000/api/user/login', $this->loginData)->decodeResponseJson();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user