jeudi 12 octobre 2017

Laravel 5.5. Can't instantiate class with a specific name

I have 2 classes: \App\Services\WeatherService and \App\Services\WeatherService1 both are equal.

In my \Tests\Unit\Services\WeatherServiceTest I'm trying to make a new instance, but I can't instantiate \App\Services\WeatherService.

//Works perfect
$some = new WeatherService1(new \Forecast\Forecast(config('darksky.key')));

dd($some);

/*
App\Services\WeatherService1 {#2405
  -forecastApi: Forecast\Forecast {#2406
    -api_key: "somekey"
  }
}
*/

And original weather service gives

//Not working
$some = new WeatherService(new \Forecast\Forecast(config('darksky.key')));

dd($some); //app\Services\WeatherService {#2405}

What could be done to solve this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire