/**
  * Creates Preferred Job Form
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return PreferredJobFieldset
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $serviceLocator \Zend\ServiceManager\AbstractPluginManager */
     $services = $serviceLocator->getServiceLocator();
     /* @var \Geo\Options\ModuleOptions $options */
     $options = $services->get('Geo/Options');
     $fs = new PreferredJobFieldset();
     $fs->setLocationEngineType($options->getPlugin());
     return $fs;
 }
 /**
  * @covers ::init()
  */
 public function testInitializesItself()
 {
     $add = [['name' => 'typeOfApplication', 'type' => 'select', 'options' => ['value_options' => $this->attributes['typeOfApplicationOptions'], 'label' => 'desired type of work', 'description' => 'Do you want to work permanently or temporary?'], 'attributes' => ['title' => 'please describe your position', 'description' => 'what kind of ', 'data-placeholder' => 'please select', 'data-allowclear' => 'false', 'data-searchbox' => -1, 'multiple' => true, 'data-width' => '100%']], ['name' => 'desiredJob', 'type' => 'Text', 'options' => ['label' => 'desired job position', 'description' => 'Enter the title of your desired job. Eg. "Software Developer" or "Customer Service Representative"'], 'attributes' => ['title' => 'please describe your position']], ['name' => 'geo-location', 'type' => 'Location', 'options' => ['label' => 'desired job location', 'description' => 'Where do you want to work?', 'engine_type' => 'testengine'], 'attributes' => ['title' => 'please describe your position']], ['name' => 'willingnessToTravel', 'type' => 'Select', 'options' => ['value_options' => $this->attributes['willingnessToTravelOptions'], 'label' => 'Willingness to travel', 'description' => 'Enter your willingness to travel.'], 'attributes' => ['data-placeholder' => 'please select', 'data-allowclear' => 'false', 'data-searchbox' => -1, 'data-width' => '100%']], ['name' => 'expectedSalary', 'type' => 'Text', 'options' => ['label' => 'expected Salary', 'description' => 'What is your expected Salary?'], 'attributes' => ['title' => 'please describe your position']]];
     $callCount = count($add);
     $addArgValidator = function ($arg) use($add, $callCount) {
         static $count = 0;
         /* PPHUnit calls this callback again after all invokations are made
          * I don't know why, but therefor the need to check if $count is greater that 7
          */
         return $callCount - 1 < $count || $arg === $add[$count++];
     };
     $this->target->expects($this->exactly($callCount))->method('add')->with($this->callback($addArgValidator))->will($this->returnSelf());
     $this->target->setLocationEngineType('testengine');
     $this->target->init();
 }