lundi 27 août 2018

PhpUnit testing elasticsearch results are empty

I am writing testing methods of my app and in my app I use elasticsearch. When I run a test method which should return values using elasticsearch, the response is always empty. How can I solve the problem? Here is the code I send.

public function testGetPosts()

{
    $brand = factory(Brand::class)->create();
    $account = factory(Account::class)->create();
    $post = factory(Post::class)->create();

    $response = $this->actingAs($this->owner)->json(
        'GET',
        ('/api/publish/posts'),
        ['account_id' => [(string) $account->id],
        'skip' => 0]
    );

    $response->assertStatus(200);
}

Aucun commentaire:

Enregistrer un commentaire