Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good PHP mock framework [closed]

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 ;) ).

like image 659
Max Avatar asked Nov 16 '09 08:11

Max


2 Answers

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.

like image 96
Noah Goodrich Avatar answered Oct 23 '22 16:10

Noah Goodrich


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.
like image 20
Steve Avatar answered Oct 23 '22 17:10

Steve