Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mock Mock Mock - Mocking-Frameworks

Mock Mock Mock - Mocking-Frameworks

Mocks in unit tests. You can't live with them. You can't live without them. You need them. But as you plan on how to test your code, you also should ask yourself which Mocking-Library do you want to use. New project, legacy code or code that is hard to test: depending on the project, some libraries can be really helpful to build up your tests and save time. This talk is about common Mocking-Libraries and their (dis)advantages.
The talk of those slides were part of PHPUGKA Oct. 22nd. 2015.

Claudio Zizza

October 22, 2015
Tweet

More Decks by Claudio Zizza

Other Decks in Technology

Transcript

  1. Test Doubles Mostly used in tests: • Dummies • Stubs

    • Mocks (We do only Mocks for now)
  2. Prophecy $mockFw = new Prophet(); $prophecy = $mockFw->prophesize(MathInterface::class); $prophecy->sum(1, 1)

    ->willReturn(2) ->shouldBeCalledTimes(1); $math = $prophecy->reveal();