Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this questionIs 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?
Wha开发者_开发技巧t I would really like is something easy and yet powerful like the Moq framework for C# in PHP (no generics, lambdas etc. of course ;) ).
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.
I would go for PHPUnit.
- I have positive experiences with it,
- it is supported in IDEs (Zend studio, NetBeans),
- and Zend framework (Doctrine ORM, etc.) developers use it also.
Check out FBMock
It's a very straightforward and simple mocking framework that is used extensively in Facebook's large PHP codebase.
精彩评论