# Faster dependency mocking 02

I’ve reviewed the dependency mocking mechanism to remove DocBlock requirements.

## The problem

While I try to document all of my code public methods I also understand that keeping it up to date can be quite a chore.
Automatic doc block generation, something editors like Sublime Text or PhpStorm will do entering /** before a function or method definition, is a comfort I do not want to loose.
If I had to manually re-define @depends notation in each DocBlock then I’ve just moved the effort somewhere else from the test code; since I can automate the generation of those @depends notations using live templates or snippets in either IDEs I can probably automate that process at a PHP level as well.

## The current solution

Given a class like

class TestClass232
{

public function __construct(DependencyClass231 $dep231, Int1$int1)
{
...
}

public function methodOne(stdClass $one, stdClass$two, stdClass $three) { ... } } calling, inside a test method, the tad_DependencyMocker_Smart class (name is temporary and subject to change before release), on the class methodOne method will mock the method dependencies and return them $mocker = new tad_DependencyMocker_Smart('TestClass232', 'methodOne');
extract($mocker->getMocksArray()); // set expectations, return values etc. on the mocks$dep231->expects(...

// inject the mocks into the subject under test
$sut = new TestClass232($dep231, $int1);$sut->methodOne($one,$two, $three); Extra method stubbing on a per-class base remains an option // also stub fooMethod and bazMethod for any Int1 mocks$extra = [
'Int1' => ['fooMethod', 'bazMethod']
];

// get and extract the mocks
// set and exercise the sut and pre conditions