public function testShouldUseArgumentsParserOnMagicInvokeMethod() { $expectedArguments = array(1, 2, 3); $argumentParserMock = $this->getMock('PHPFluent\\Callback\\ArgumentParser\\ArgumentParserInterface'); $callback = new Callback(function ($a, $b, $c) { }, $argumentParserMock); $argumentParserMock->expects($this->once())->method('parse')->with($expectedArguments, $callback->getParameters())->will($this->returnValue($expectedArguments)); $callback($expectedArguments[0], $expectedArguments[1], $expectedArguments[2]); }