atoum/atoum — pull request #289 by mageekguy (2013-10-21 10:12:02+00:00)
Title: Add $this->nextMocketMethod handler to simplify mock management.

Currently, it's possible to set default value of all arguments of a method to null in a mocked class.
To do that, you should do in a test method:
```php
$this
->if(
$client = new testedClass($socket = uniqid()),
$this->function->socket_write->doNothing(),
$this->mockGenerator->orphanize('__construct'), // the trick is here!
$heartbeat = new \mock\command\request\heartbeat() // So it's possible to create an instance of heartbeat class without any argument!
)
->then
->variable($client->sendAcknowledgement($heartbeat))->isIdenticalTo($client)
;
```
I think that it's not simple and not intuitive.
So, this PR introduce an another solution to do that:
```php
$this
->if(
$client = new testedClass($socket = uniqid()),
$this->function->socket_write->doNothing(),
$this->nextMockedMethod->__construct->canHaveNoArgument(), // The new syntax is here!
$heartbeat = new \mock\command\request\heartbeat() // So it's possible to create an instance of heartbeat class without any argument!
)
->then
->variable($client->sendAcknowledgement($heartbeat))->isIdenticalTo($client)
;
```
Moreover, you can do:
```php
$this->nextMockMethod->doesSomething->doesNothing();
// which is equivalent to
// $mockController = new mock\controller();
// $mockController->doesSomething = function() {}; // Or // $mockController->doesSomething->doesNothing()

$this->nextMockMethod->doesSomething->canNotCallItsParent();
// whicj is equivalent to
// $this->mockGenerator->shunt('doesSomething');
```
Finally, this PR add unit tests about test\mock\generator.