mercredi 11 octobre 2017

Laravel 5.5. Can't instantiate a class in the setUp()

I'm trying to create an instance of the class, that I want to test:

class WeatherServiceTest extends TestCase
{
    protected function setUp()
    {
        parent::setUp();

        $this->mock           = \Mockery::mock(\Forecast\Forecast::class);
        $this->weatherService = $this->app->makeWith(WeatherService::class, ['forecastApi' => $this->mock]);
    }
}

But it's not "stepping into" the controller of the WeatherService and not instantiating properly this class.

It gives some sort of "an empty class wrapper".

dd($this->weatherService) //app\Services\WeatherService {#2420}

In controller autoresolving instantiating this class properly.

Have anyone faced such a strange issue?)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire