I wrote this with DI:
public function test_mock_get_data()
{
$this->mock(downloadCard::class, function ($mock) {
$mock->shouldReceive('_downloadCardsFromBoard()')
->once()
->andReturn(new Request(
File::get('tests/test_data/cards.json'),
$status =200,
$headers=[],
))
->andReturnValues(json_decode(File::get('tests/test_data/cards.json'),TRUE));
});
$response = $this->artisan('trello-monitor:sync');
}
give me follwing error:
Mockery\Exception\BadMethodCallException: Received Mockery_0_App_ClassU_downloadCard::_downloadCardsFromBoard(), but no expectations were specified
the artisan command is so done:
$cards = $this->unirest->_downloadCardsFromBoard($boardId);
foreach($cards as $index=>$card) {
echo $index.' of '.count($cards)."\r\n";
$this->unirest->createCard($card);
}
essentially if I comment out the line:
// $this->unirest->createCard($card);
the test passes but the command must be done like this, I don't know how to solve