Exemplo n.º 1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage A processor for "unknown" action was not found.
  */
 public function testGetUnknownProcessor()
 {
     $processor = $this->getMockBuilder('Oro\\Component\\ChainProcessor\\ActionProcessor')->disableOriginalConstructor()->getMock();
     $processor->expects($this->once())->method('getAction')->willReturn('test');
     $actionProcessorBag = new ActionProcessorBag();
     $actionProcessorBag->addProcessor($processor);
     $actionProcessorBag->getProcessor('unknown');
 }
Exemplo n.º 2
0
 /**
  * @param string      $action
  * @param string|null $entityClass
  *
  * @return Context
  */
 protected function getConfig($action, $entityClass)
 {
     $processor = $this->processorBag->getProcessor($action);
     /** @var Context $context */
     $context = $processor->createContext();
     $context->removeConfigExtra(SortersConfigExtra::NAME);
     $context->addConfigExtra(new DescriptionsConfigExtra());
     $context->setRequestType(RequestType::REST);
     if ('rest_json_api' === $this->docViewDetector->getView()) {
         $context->setRequestType(RequestType::JSON_API);
     }
     $context->setLastGroup('initialize');
     if ($entityClass) {
         $context->setClassName($entityClass);
     }
     $processor->process($context);
     return $context;
 }