Ejemplo n.º 1
0
 public function testAttributeLabels()
 {
     $model = new User();
     // Check attribute label exists
     $attrLabels = $model->attributeLabels();
     $this->assertTrue(isset($attrLabels['username']));
 }
Ejemplo n.º 2
0
 /**
  * testing method return array type
  */
 public function testTypeFunction()
 {
     $model = new User();
     $model->login = "******";
     $model->password = "******";
     $model->profil = "clinicien";
     $model->nom = "testNom";
     $model->prenom = "testPrénom";
     $model->email = "*****@*****.**";
     $model->telephone = "0123456789";
     $model->address = "5 rue Marat";
     $model->centre = "Paris";
     $criteria = new EMongoCriteria();
     $criteria->login = "******";
     $user = User::model()->find($criteria);
     $this->assertInternalType('object', $model->model());
     $this->assertInternalType('array', $model->rules());
     $this->assertInternalType('array', $model->attributeLabels());
     $this->assertInternalType('array', $model->getAllUsersLastnames());
     $this->assertInternalType('array', $model->getAllUsersFirstnames());
     $this->assertInternalType('array', $model->getAllUsersLogin());
     $this->assertInternalType('array', $model->getAllUsersEmail());
     $this->assertInternalType('array', $model->getAllUsersByLogin($model));
     $model->profil = "clinicien";
     $this->assertInternalType('string', $model->getProfil());
     $model->profil = "";
     $this->assertInternalType('string', $model->getProfil());
     $this->assertInternalType('array', $model->getArrayProfil());
     $this->assertInternalType('object', $model->getArrayProfilSorted());
     $this->assertInternalType('array', $model->getArrayProfilFiltered());
     $this->assertInternalType('array', $model->getArrayAvailableProfil($user->_id));
     $this->assertInternalType('array', $model->getArrayCentre());
     $this->assertNull($model->passwordValidator());
     $this->assertNull($model->telValidator());
     $this->assertNull($model->gsmValidator());
     $this->assertNull($model->alphaOnly());
     $this->assertNull($model->alphaNumericOnly());
     $this->assertNull($model->addressValidator());
     $this->assertNull($model->centreValidator());
     $model->profil = array();
     $model->profil[] = "administrateur";
     $this->assertInternalType('string', $model->getDefaultProfil());
     $model->profil = array();
     $model->profil[] = "neuropathologiste";
     $this->assertInternalType('string', $model->getDefaultProfil());
     $model->profil = array();
     $model->profil[] = "geneticien";
     $this->assertInternalType('string', $model->getDefaultProfil());
     $model->profil = array();
     $model->profil[] = "clinicien";
     $this->assertInternalType('string', $model->getDefaultProfil());
     $model->profil = array();
     $model->profil[] = "chercheur";
     $this->assertInternalType('string', $model->getDefaultProfil());
 }
Ejemplo n.º 3
0
 /**
  * Declares the attribute labels.
  * If an attribute is not delcared here, it will use the default label
  * generation algorithm to get its label.
  */
 public function attributeLabels()
 {
     $labels = array('reTypePassword' => 'Подтвердите пароль');
     return array_merge(parent::attributeLabels(), $labels);
 }
Ejemplo n.º 4
0
 public function proposedFields($scenario = '', $proposeRequired = false)
 {
     $specialFields = $this->specialFields($scenario);
     $form = User::form();
     $_fields = array_diff(array_keys($form['elements']), $specialFields['unsafe']);
     if (!$proposeRequired) {
         $_fields = array_diff($_fields, $specialFields['required']);
     }
     $labels = User::attributeLabels();
     $fields = array();
     foreach ($_fields as $field) {
         $fields[$field] = $labels[$field];
     }
     foreach (User::extraLabels() as $field => $label) {
         $fields[$field] = Yii::t('cms', 'Extra field') . ': ' . $label;
     }
     return $fields;
 }
Ejemplo n.º 5
0
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['password' => \Yii::t('admin/t', 'Password'), 'passwordRepeat' => \Yii::t('admin/t', 'Repeat Password')]);
 }
Ejemplo n.º 6
0
 /**
  * @return array customized attribute labels (name=>label)
  */
 public function attributeLabels()
 {
     return CMap::mergeArray(parent::attributeLabels(), array('textPassword' => UserModule::t("Password")));
 }