Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to mock client->search while used complexSearch #187

Open
sandeepnanda2 opened this issue Mar 6, 2019 · 1 comment
Open

Not able to mock client->search while used complexSearch #187

sandeepnanda2 opened this issue Mar 6, 2019 · 1 comment

Comments

@sandeepnanda2
Copy link

sandeepnanda2 commented Mar 6, 2019

Sample code
public function searchQuery($params){
return $result = self::complexSearch($params);
}

Now to mock this code in unit test, I tried as below.
$client = \Mockery::mock(Client::class);
$client->shouldReceive('search')->andReturn(['categories']);
$this->elasticquentModel->shouldReceive('complexSearch')->andReturn($client);

But not able to mock, as the method is in trait not in class.
can anyone help me in mocking the result of complexSearch().

@AratKruglik
Copy link

The same for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants