public function it_configures_mass_actions(BuildBefore $event, DatagridConfiguration $datagridConfig, ActionInterface $indexAction, ActionFactory $actionFactory, ActionInterface $action1, ActionInterface $action2)
 {
     $action1->implement('Pim\\Bundle\\CustomEntityBundle\\Action\\GridActionInterface');
     $action2->implement('Pim\\Bundle\\CustomEntityBundle\\Action\\GridActionInterface');
     $actionFactory->getAction('entity', 'action1')->willReturn($action1);
     $actionFactory->getAction('entity', 'action2')->willReturn($action2);
     $action1->getGridActionOptions()->willReturn(['action1_key1' => 'action1_value1']);
     $datagridConfig->getName()->willReturn('entity');
     $indexAction->getMassActions()->willReturn(['action1', 'action2']);
     $indexAction->getRowActions()->willReturn([]);
     $indexAction->getOptions()->willReturn([]);
     $datagridConfig->offsetGetByPath('[extends]')->willReturn('custom_entity');
     $datagridConfig->offsetGetByPath('[properties]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[actions]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[source]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[mass_actions]')->willReturn(['action2' => []]);
     $datagridConfig->offsetSetByPath("[source]", ["entity" => "entity_class", "type" => "pim_custom_entity"])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[actions]", [])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[properties]", ['id' => []])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[mass_actions]", ["action2" => [], "action1" => ["action1_key1" => "action1_value1"]])->shouldBeCalled();
     $this->buildBefore($event);
 }
 public function it_calls_actions(Request $request, ActionInterface $action)
 {
     $action->execute($request)->willReturn('success');
     $this->executeAction('entity', 'action')->shouldReturn('success');
 }
 /**
  * Sets the mass actions
  *
  * @param \Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration $datagridConfig
  * @param \Pim\Bundle\CustomEntityBundle\Action\ActionInterface            $indexAction
  */
 protected function setMassActions(DatagridConfiguration $datagridConfig, ActionInterface $indexAction)
 {
     $name = $indexAction->getConfiguration()->getName();
     $massActions = $datagridConfig->offsetGetByPath('[mass_actions]') ?: [];
     foreach ($indexAction->getMassActions() as $massActionType) {
         if (isset($massActions[$massActionType])) {
             continue;
         }
         $massAction = $this->actionFactory->getAction($name, $massActionType);
         $massActions[$massActionType] = $massAction->getGridActionOptions();
     }
     $datagridConfig->offsetSetByPath('[mass_actions]', $massActions);
 }