/** * Helper function to merge arguments with default arguments according to their registration * This usually happens in ViewHelperInvoker before the view helper methods are called * * @param ViewHelperInterface $viewHelper * @param array $arguments */ protected function setArgumentsUnderTest(ViewHelperInterface $viewHelper, array $arguments = []) { $argumentDefinitions = $viewHelper->prepareArguments(); foreach ($argumentDefinitions as $argumentName => $argumentDefinition) { if (!isset($arguments[$argumentName])) { $arguments[$argumentName] = $argumentDefinition->getDefaultValue(); } } $viewHelper->setArguments($arguments); }
/** * @return ArgumentDefinition[] */ public function getArgumentDefinitions() { return $this->uninitializedViewHelper->prepareArguments(); }
/** * Return an array of ArgumentDefinition instances which describe * the arguments that the ViewHelper supports. By default, the * arguments are simply fetched from the ViewHelper - but custom * implementations can if necessary add/remove/replace arguments * which will be passed to the ViewHelper. * * @param ViewHelperInterface $viewHelper * @return ArgumentDefinition[] */ public function getArgumentDefinitionsForViewHelper(ViewHelperInterface $viewHelper) { return $viewHelper->prepareArguments(); }