Php – Good PHP mock framework

frameworksmockingphp

Is there a good standalone mock framework for PHP? Currently I am using Simpletest framework for unit testing. I like the framework, but I dont like how you create and setup a mock in it. I then tried PHPMock, I like how it can be used, but it I encountered some bugs that get annoying over time … Or would it be best to switch over to PHPUnit for unit testing and mocking?

What I would really like is something easy and yet powerful like the Moq framework for C# in PHP (no generics, lambdas etc. of course 😉 ).

Best Solution

While I've not implemented a mock framework myself, I was impressed with Mockery.

Its a completely independent mock and stub framework that you should be able to integrate easily with any existing framework or just into your existing code base.