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.
33 lines
915 B
33 lines
915 B
<?php
|
|
|
|
namespace Tests\Feature\Cart;
|
|
|
|
use App\Product;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
use Tests\TestCase;
|
|
|
|
class SearchProductsTest extends TestCase
|
|
{
|
|
use DatabaseMigrations;
|
|
|
|
/** @test */
|
|
public function retrieving_product_list_by_ajax_post_request()
|
|
{
|
|
$this->disableExceptionHandling();
|
|
factory(Product::class)->create(['name' => 'Hemaviton']);
|
|
factory(Product::class)->create(['name' => 'Zee']);
|
|
$product1 = factory(Product::class)->create(['name' => 'Bisolvon 1']);
|
|
$product2 = factory(Product::class)->create(['name' => 'Bisolvon 2']);
|
|
|
|
$user = $this->loginAsUser();
|
|
|
|
$response = $this->post(route('api.products.search'), ['query'=> 'Bis']);
|
|
|
|
$response->assertSuccessful();
|
|
|
|
$response->assertJsonFragment([
|
|
'name' => 'Bisolvon 1',
|
|
'name' => 'Bisolvon 2',
|
|
]);
|
|
}
|
|
}
|