开发者

Good PHP mock framework [closed]

开发者 https://www.devze.com 2022-12-11 07:31 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消