Codeception/Codeception — pull request #360 by svsool (2013-06-08 16:26:04+00:00)
Title: Add missing mock matcher in Stub

I missed this functionality in Stub class, but it present in phpunit
```php
$mock $this->getMockBuilder('SomeClass')
->setMethods('trackInvocationCount')
->getMock();
$mock->expects($this->once())
->method('trackInvocationCount')
->will($this->returnCallback(function() {return true}));

$mock->trackInvocationCount();
```

now it's pretty easy with Stub

```php
$mock Stub::makeEmpty('SomeClass', array(
'trackInvocationCount',
Stub::once(function() {return true})),
$this

$mock->trackInvocationCount();
```

and another example
```php
$mock Stub::makeEmpty('SomeClass', array('methodNeverCalled', Stub::once(), $this)

$mock->trackInvocationCount();
```

if we need track methods invocations we must pass $this (current test referece) as last argument, it's necessarily because we need add mock in $mockObjects array in base class of our test, I didn't find clear solution so that don't pass current test object reference in function without extending PHPUnit_Framework_TestCase class or binding Stub as listener for codeception test teardown event, I still think about it, but current code work perfectly for me