コード例 #1
0
 /**
  *
  * @dataProvider provideSetSelectableOrganizationsTestData
  *
  * @param $orgs
  * @param $addEmptyOption
  */
 public function testSetSelectableOrganizations($orgs, $addEmptyOption)
 {
     $this->assertSame($this->target, $this->target->setSelectableOrganizations($orgs, $addEmptyOption), 'Fluent interface broken');
     $values = $this->target->getValueOptions();
     if ($addEmptyOption) {
         $this->assertArrayHasKey('0', $values, 'Empty option was not created');
         $this->assertEquals(count($orgs) + 1, count($values));
     } else {
         $this->assertEquals(count($orgs), count($values));
     }
 }
コード例 #2
0
 /**
  * Creates the organization select box.
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $serviceLocator \Zend\ServiceManager\AbstractPluginManager
      * @var $jobsRepository \Jobs\Repository\Job
      */
     $services = $serviceLocator->getServiceLocator();
     $repositories = $services->get('repositories');
     $jobsRepository = $repositories->get('Jobs');
     $organizations = $jobsRepository->findActiveOrganizations();
     $select = new OrganizationSelect();
     $select->setSelectableOrganizations($organizations);
     return $select;
 }