Elasticquent icon indicating copy to clipboard operation
Elasticquent copied to clipboard

Not able to mock client->search while used complexSearch

Open sandeepnanda2 opened this issue 5 years ago • 1 comments

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().

sandeepnanda2 avatar Mar 06 '19 13:03 sandeepnanda2

The same for me

AratKruglik avatar Aug 08 '19 13:08 AratKruglik