public function createExpectation($mock, $method, array $arguments = null)
{
if ($expectation = $this->getExpectation($mock, $method, $arguments)) {
if (!$expectation->isCallCountConstrained()) {
$expectation->atMost()->times(1);
}
}
$expectation = $mock->shouldReceive($method);
$this->withArguments($expectation, $arguments);
return $expectation;
}