コード例 #1
0
 protected static function createUser($name, array $roles = array(), Workspace $personalWorkspace = null)
 {
     $user = new User();
     $user->setFirstName($name . 'FirstName');
     $user->setLastName($name . 'LastName');
     $user->setUsername($name . 'Username');
     $user->setPlainPassword($name . 'Password');
     $user->setMail($name . '@claroline.net');
     $user->setCreationDate(self::$time);
     foreach ($roles as $role) {
         $user->addRole($role);
     }
     if ($personalWorkspace) {
         $user->setPersonalWorkspace($personalWorkspace);
     }
     self::create($name, $user);
 }