protected function getRequestParserMock()
{
if (!isset($this->requestParserMock)) {
$that =& $this;
$callback = function ($href, $attribute) use($that) {
foreach ($that->getParseHrefExpectationsMap() as $map) {
if ($map[0] == $href && $map[1] == $attribute) {
if ($map[2] instanceof \Exception) {
throw $map[2];
} else {
return $map[2];
}
}
}
return null;
};
$this->requestParserMock = $this->getMock('eZ\\Publish\\Core\\REST\\Common\\RequestParser');
$this->requestParserMock->expects($this->any())->method('parseHref')->will($this->returnCallback($callback));
}
return $this->requestParserMock;
}