mockCrmTransport(); } private function mockCrmTransport(): void { $apiInterface = Mockery::mock(ApiInterface::class); $apiInterface->shouldReceive('call')->byDefault()->andReturn( new CrmResponse( ApiStatus::OK, new GuzzleResponse(200, [], (string) json_encode([ 'version' => Utils::getPackageInfo()['version'], 'data' => [], ])) ) ); $refClientModel = new \ReflectionProperty(ClientModel::class, 'apiInterface'); $refClientModel->setValue(null, $apiInterface); $refCrmApi = new \ReflectionProperty(CrmApiV4::class, 'apiInterface'); $refCrmApi->setValue(null, $apiInterface); } /** * Create and bind a mock CrmService to the container to ensure no real CRM calls are made in tests. */ protected function mockCrmService(): CrmService { return $this->mock(CrmService::class); } }