Пример #1
0
 /**
  * Create route object.
  *
  * @param array $routeData Expected format:
  *  <pre>array(
  *      'routePath' => '/categories/:categoryId',
  *      'class' => 'Magento\Catalog\Service\CategoryService',
  *      'serviceMethod' => 'item'
  *      'secure' => true
  *  );</pre>
  * @return \Magento\Webapi\Controller\Rest\Router\Route
  */
 protected function _createRoute($routeData)
 {
     /** @var $route \Magento\Webapi\Controller\Rest\Router\Route */
     $route = $this->_routeFactory->createRoute('Magento\\Webapi\\Controller\\Rest\\Router\\Route', $this->_formatRoutePath($routeData[self::KEY_ROUTE_PATH]));
     $route->setServiceClass($routeData[self::KEY_CLASS])->setServiceMethod($routeData[self::KEY_METHOD])->setSecure($routeData[self::KEY_IS_SECURE])->setAclResources($routeData[self::KEY_ACL_RESOURCES])->setParameters($routeData[self::KEY_PARAMETERS]);
     return $route;
 }
Пример #2
0
 /**
  * @test
  * @expectedException \LogicException
  * @return void
  */
 public function testCreateRouteNegative()
 {
     $this->objectManager->expects($this->once())->method('create')->will($this->returnValue(new \StdClass()));
     $object = new Factory($this->objectManager);
     $object->createRoute('routerClass', 'router');
 }