protected function setUp()
 {
     parent::setUp();
     $users = new USVN_Db_Table_Users();
     $users->insert(array("users_id" => 42, "users_login" => "Telephone", "users_password" => "secret"));
     $users->insert(array("users_id" => 43, "users_login" => "Indochine", "users_password" => "secret"));
     $groups = new USVN_Db_Table_Groups();
     $groups->insert(array("groups_id" => 42, "groups_name" => "Telephone", "groups_description" => "test"));
 }
Exemple #2
0
 private function loadIntoDb()
 {
     $users = new USVN_Db_Table_Users();
     $users->getAdapter()->beginTransaction();
     foreach (array_keys($this->_users_password) as $user) {
         $data['users_login'] = $user;
         $data['users_password'] = $this->_users_password[$user];
         $where = $users->getAdapter()->quoteInto('users_login = ?', $user);
         $user_row = $users->fetchRow($where);
         try {
             if ($user_row === null) {
                 $users->insert($data);
             } else {
                 $users->update($data, $where);
             }
         } catch (Exception $e) {
             $users->getAdapter()->rollBack();
             throw new USVN_Exception(T_("Can't add users %s. Import cancel."), $user);
         }
     }
     $users->getAdapter()->commit();
 }
Exemple #3
0
 /**
  * Create and save a user
  *
  * @return USVN_Db_Table_Row_User
  */
 protected function createUser($login, $password = "******")
 {
     $table = new USVN_Db_Table_Users();
     try {
         $user = $table->insert(array("users_login" => $login, "users_password" => USVN_Crypt::crypt($password), 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**'));
         $user = $table->find($user)->current();
         return $user;
     } catch (Exception $e) {
         $this->fail($login . " : " . $e->getMessage());
     }
 }
Exemple #4
0
 public function testUserUpdateHtpasswd()
 {
     $table = new USVN_Db_Table_Users();
     $table->insert(array('users_login' => 'Toto', 'users_password' => 'titititi', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**'));
     $table->updateHtpasswd();
     $text = "Toto:titititi\n";
     $contenu = file_get_contents(Zend_Registry::get('config')->subversion->passwd);
     $this->assertEquals($text, $contenu);
 }