Support the ongoing development of Laravel.io →
Eloquent Testing
Last updated 2 years ago.
0

I had the same problem and it was solved by passing full name of class that you want to mock.

With this in mind your mocking code will look like:

$this->questionMock = Mockery::mock('App\Question');
...
$this->app->instance('App\Question', $this->questionMock);
Last updated 9 years ago.
0

To anyone looking at this question in the future: Laravel now recommends ::class syntax in the framework.

$this->questionMock = Mockery::mock(Question::class);
$this->app->instance(Question::class, $this->questionMock);
0

Sign in to participate in this thread!

Eventy

Your banner here too?

martynbiz martynbiz Joined 15 Feb 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.