public function testGetProductIds() { $parser = new ArgsParser($this->getArgs(0, '', '1')); $this->assertCount(0, $parser->getProductIds()); $parser = new ArgsParser($this->getArgs(1, '1,2', '1')); $this->assertCount(2, $parser->getProductIds()); }
/** * {@inheritdoc} */ public function handle(MassActionHandlerArgs $args) { $argsParser = new ArgsParser($args); $shoppingList = $this->shoppingListLineItemHandler->getShoppingList($argsParser->getShoppingListId()); if (!$shoppingList) { return $this->generateResponse($args); } try { $addedCnt = $this->shoppingListLineItemHandler->createForShoppingList($shoppingList, $argsParser->getProductIds()); return $this->generateResponse($args, $addedCnt, $shoppingList->getId()); } catch (AccessDeniedException $e) { return $this->generateResponse($args); } }