Пример #1
0
 /**
  * Get the Request parser
  *
  * @return \eZ\Publish\Core\REST\Common\RequestParser|\PHPUnit_Framework_MockObject_MockObject
  */
 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;
 }