Thank you for answering @bobbybouwmann . Unfortunately this has not been the solution. Let me show you the small implementation that's currently working (which i dded to debug a little bit).
public function get(string $route, array $params, array $middlewares): JsonResponse
{
dd('', 'we are at implementation, not the mock.', __CLASS__ . '::'. __FUNCTION__ . ':'. __LINE__);
try {
return $this->request(__FUNCTION__, $route, $params, $middlewares);
} catch (\Exception $exception) {
return response()->json($this->exceptionResponseMessage, 502);
}
}
Test is looking like you suggested (or i think it is):
/** @test */
public function can_be_called_with_country_ARG_or_ESP_and_valid_customer_number_from_9_to_12_digits()
{
// Dependencies:
$actualCustomerNumber = "000086866920";
$domApiMock = Mockery::mock(\App\Dom\Contracts\DomApiRequest::class);
/** @var \App\Dom\Contracts\DomApiRequest $domApiMock | proxy mocked object */
$domApiMock
->shouldReceive('get')
->with('', ['country' => 'ARG', 'number' => $this->fakeCustomer], [])
->once()->andReturn([]);
$this->app->instance(\App\Dom\Contracts\DomApiRequest::class, $domApiMock);
// Execute
$this->get('country/ARG/customer/' . $actualCustomerNumber, $this->headers);
//Check
$this->seeJson([]);
$this->assertResponseStatus(204);
}
When running phpunit i get:
PHPUnit Pretty Result Printer 0.20.3 by Codedungeon and contributors.
==> Configuration: ~/PhpstormProjects/ig-internal-api/phpunit-printer.yml
PHPUnit 7.4.3 by Sebastian Bergmann and contributors.
==> BaseRouteTest ✓ ""
"we are at implementation, not the mock."
"App\Dom\AdvantageApi::get:29"