You always need to tell Mockery to close the Mock.
class MyTest extends TestCase {
public function tearDown()
{
\Mockery::close();
}
// Your tests
}
Hello,
I'm using L4 and just started to use Mockery in a test class, after that class finishes the next test class is throwing a Mockery fetchMock() error. It seems the Mock persists over the different test classes. I've tried to manually refresh the app but still having the issue.
The mock is an alias because the it's send method is static
$this->mockMailHelper = $this->mock('alias:MailHelper');
I'm closing properly in the tearDown method:
Mockery::close();
When I run the test classes in isolation they both pass, however together they fail. I've inspected the class in the ioc in the test class that doesn't contain the Mock and it's getting the Mocked class from the previous test file.
dd($this->app->make('MailHelper'));
Hope that all makes sense! Anyone have any ideas?
Please or to participate in this conversation.