public function __construct(Company $company)
 {
     parent::__construct(strtolower(str_replace('\\', '-', get_class($this))));
     $companies = $company->fetchType(['Háskóli']);
     $options = array();
     foreach ($companies as $item) {
         $options[$item->id] = $item->name;
     }
     $this->setAttribute('method', 'post');
     $this->add(array('name' => 'university-select', 'type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('placeholder' => 'Háskólar'), 'options' => array('label' => 'Háskólar', 'empty_option' => 'Veldu háskóla', 'value_options' => $options)));
     $this->add(array('name' => 'submit-university-select', 'type' => 'Zend\\Form\\Element\\Submit', 'attributes' => array('value' => 'Submit'), 'options' => array('label' => 'Submit')));
 }
Example #2
0
 /**
  * Get company by type test
  */
 public function testFetchType()
 {
     $service = new Company();
     $service->setDataSource(self::$pdo);
     $result = $service->fetchType();
     $this->assertEquals(4, count($result));
     $this->assertInternalType('array', $result);
     $result = $service->fetchType(['hf']);
     $this->assertEquals(2, count($result));
     $result = $service->fetchType(['hundur']);
     $this->assertEquals(0, count($result));
 }