Skip to content

Instantly share code, notes, and snippets.

@andyfowler andyfowler/php-mocking.md
Last active Aug 29, 2015

Embed
What would you like to do?
Frustrating landscape of PHP mocking

Why are PHP's mocking libraries so weak?

phpunit-mock-objects

Kludgy, disgusting syntax.

mockery

Seems to have the most momentum, but I don't like its DSL, which seems more complex than 95% of cases need. Bad docs: a 1,600-line README?

AspectMock

Dead-simple syntax (four public methods to remember) and the ability to mock non-dependency-injected code. Heavy overhead in the AOP framework it relies on. But this is still the library I'm liking the best.

Phake

Nicer verification (like spies), but stubbing syntax is as bad as mockery. Bad docs.

Prophecy

Come on!

Oh come on! Who's inventing this stuff?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.