Mocking framework improvments ideas

I’ve uploaded a new Mocking Framework project to my Github account: https://github.com/danrevah/ShortifyPunit
A little background:
The framework was created to make my life much easier in Mocking chained methods when testing with PHPUnit.

For example, if I needed to mock the following method chain:

$entity->first_method('foo', 'bar')->second_method('foo')->third_method()->fourth_method()->execute();

without using ShortifyPunit framework I would needed to mock each object of the response and to inject it to the previous call which is kind a LOT of mocking to code!

so using ShortifyPunit I could just easily mock it using this type of code:

// mock the entity
$entityMock = ShortifyPunit::mock('EntityObject');

// Stub
ShortifyPunit::when($entityMock)->first_method('foo', 'bar')->second_method('foo')->third_method()->fourth_method()->execute()->returns(1);

I would love to hear your guys thoughts about it. and maybe even ideas to improve.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.