예제 #1
0
 public function user_sendInvite($toEmail)
 {
     return UserCommands::sendInvite($this->_projectId, $this->_userId, $this->_website, $toEmail);
 }
 public function testSendInvite_SendInvite_PropertiesFromToBodyOk()
 {
     $this->environ->clean();
     $inviterUserId = $this->environ->createUser("inviteruser", "Inviter Name", "*****@*****.**");
     $toEmail = '*****@*****.**';
     $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $project->projectCode = 'someProjectCode';
     $project->write();
     $delivery = new MockUserCommandsDelivery();
     $toUserId = UserCommands::sendInvite($project->id->asString(), $inviterUserId, $this->environ->website, $toEmail, $delivery);
     // What's in the delivery?
     $toUser = new UserModel($toUserId);
     $senderEmail = 'no-reply@' . $this->environ->website->domain;
     $expectedFrom = array($senderEmail => $this->environ->website->name);
     $expectedTo = array($toUser->emailPending => $toUser->name);
     $this->assertEqual($expectedFrom, $delivery->from);
     $this->assertEqual($expectedTo, $delivery->to);
     $this->assertPattern('/Inviter Name/', $delivery->content);
     $this->assertPattern('/Test Project/', $delivery->content);
     $this->assertPattern('/' . $toUser->validationKey . '/', $delivery->content);
 }