Ejemplo n.º 1
0
 /**
  * Register a new user with password and optionally add them to a project if allowed by permissions
  *
  * @param array $params
  * @return string Id of written object
  */
 public function user_register($params)
 {
     return UserCommands::register($params, $this->app['session']->get('captcha_info'), $this->website);
 }
 public function testRegister_NoProjectCode_UserInNoProjects()
 {
     self::$environ->clean();
     $validCode = 'validCode';
     $params = array('id' => '', 'username' => 'someusername', 'name' => 'Some Name', 'email' => '*****@*****.**', 'password' => 'somepassword', 'captcha' => $validCode);
     $captcha_info = array('code' => $validCode);
     $delivery = new MockUserCommandsDelivery();
     $userId = UserCommands::register($params, $captcha_info, self::$environ->website, $delivery);
     $user = new UserModel($userId);
     $this->assertEquals($params['username'], $user->username);
     $this->assertEquals(0, $user->listProjects(self::$environ->website->domain)->count);
 }