/**
  * Creates a widget from an array configuration
  * @param  array  $args Array of parameters for the widget.
  * The 'type' parameter is required
  * @throws NoSuchWidgetException
  * @throws NoTypeGivenException
  * @return Widget
  */
 public function create(array $args)
 {
     if (!isset($args['type'])) {
         throw new NoTypeGivenException();
     }
     $widgetClass = $this->repo->getInfo($args['type']);
     unset($args['type']);
     return $this->getWidget($widgetClass, $args);
 }
 /**
  * @dataProvider provideGroupElementFilter
  */
 public function testGroupElementFilter($type, array $input, $verifyCallback)
 {
     $classMap = array('mock' => 'MockWidget', 'groupmock' => 'MockGroupWidget');
     $repo = new WidgetRepository($classMap);
     $factory = new WidgetFactory($repo);
     $filter = new GroupElementFilter($factory);
     $widgetInfo = $repo->getInfo($type);
     $output = $input;
     $filter->filter($widgetInfo, $output);
     $this->assertTrue($verifyCallback($input, $output));
 }