示例#1
0
 public function Register()
 {
     $additionalFields = array('phone' => $this->page->GetPhone(), 'organization' => $this->page->GetOrganization(), 'position' => $this->page->GetPosition());
     $language = Resources::GetInstance()->CurrentLanguage;
     $user = $this->registration->Register($this->page->GetLoginName(), $this->page->GetEmail(), $this->page->GetFirstName(), $this->page->GetLastName(), $this->page->GetPassword(), $this->page->GetTimezone(), $language, intval($this->page->GetHomepage()), $additionalFields, $this->GetAttributeValues());
     $context = new WebLoginContext(new LoginData(false, $language));
     $plugin = PluginManager::Instance()->LoadPostRegistration();
     $plugin->HandleSelfRegistration($user, $this->page, $context);
 }
 public function testAddsUser()
 {
     $fname = 'f';
     $lname = 'l';
     $username = '******';
     $email = '*****@*****.**';
     $timezone = 'America/Chicago';
     $lang = 'foo';
     $password = '******';
     $attributeId = 1;
     $attributeValue = 'value';
     $phone = 'phone';
     $position = 'position';
     $org = 'organization';
     $homePageId = 1;
     $userId = 99889;
     $user = new FakeUser($userId);
     $extraAttributes = array(UserAttribute::Phone => $phone, UserAttribute::Organization => $org, UserAttribute::Position => $position);
     $customAttributes = array(new AttributeValue($attributeId, $attributeValue));
     $this->registration->expects($this->once())->method('Register')->with($this->equalTo($username), $this->equalTo($email), $this->equalTo($fname), $this->equalTo($lname), $this->equalTo($password), $this->equalTo($timezone), $this->equalTo($lang), $this->equalTo($homePageId), $this->equalTo($extraAttributes), $this->equalTo($customAttributes))->will($this->returnValue($user));
     $actualUser = $this->service->AddUser($username, $email, $fname, $lname, $password, $timezone, $lang, $homePageId, $extraAttributes, $customAttributes);
     $this->assertEquals($userId, $actualUser->Id());
 }
示例#3
0
 public function AddUser($username, $email, $firstName, $lastName, $password, $timezone, $language, $homePageId, $extraAttributes, $customAttributes)
 {
     $user = $this->registration->Register($username, $email, $firstName, $lastName, $password, $timezone, $language, $homePageId, $extraAttributes, $customAttributes);
     return $user;
 }