public function testGetDongleOptions() { $dongles = Dongle::model()->getDongleOptions(); $this->assertTrue(3 === count($dongles)); $this->assertTrue(is_array($dongles)); $this->assertTrue(in_array('dongle1', $dongles)); $this->assertFalse(in_array('dongle4', $dongles)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Dongle the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Dongle::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('default', 'The requested page does not exist.')); } return $model; }
?> <?php echo $form->dropDownListGroup($theme, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $model->getThemeOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($commercial, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Commercial::model()->getCommercialOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'monitor_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Monitor::model()->getMonitorOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'dongle_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Dongle::model()->getDongleOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'yeshuv_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Yeshuv::model()->getYeshuvOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->textFieldGroup($model, 'url', array('wrapperHtmlOptions' => array('class' => 'col-sm-5', 'dir' => 'ltr'))); ?> <?php echo $form->textFieldGroup($model, 'webkey_nickname', array('wrapperHtmlOptions' => array('class' => 'col-sm-5', 'dir' => 'ltr'))); ?> </fieldset>
/** * @covers Dongle::getDongleOptions * @todo Implement testGetDongleOptions(). */ public function testGetDongleOptions() { $options = $this->object->getDongleOptions(); $this->assertTrue(is_array($options)); $this->assertEquals(3, count($options)); }
public function getDongleOptions() { return CHtml::listData(Dongle::model()->findAll(array('order' => 'name')), 'id', 'name'); }