Exemplo n.º 1
0
 public function testSendVerificationEmail()
 {
     $siteDomain = 'mytestsite.tld';
     $siteName = 'MY_TEST_SITE';
     $_SERVER['HTTP_HOST'] = $siteDomain;
     Zend_Registry::set('siteName', $siteName);
     $recipient = 'root@localhost';
     $user = UserTest::createTestUser();
     $user->setEmail($recipient);
     // Real address in case we actually send mail
     $mock = new MockMailTransport();
     UserService::sendVerificationEmail($user, $mock);
     $subject = '[' . $siteName . '] Email Verification';
     $this->assertTrue($mock->called);
     $this->assertEquals($subject, $mock->subject);
     $this->assertEquals('noreply@' . $siteDomain, $mock->from);
     $this->assertContains($recipient, $mock->recipients);
     $this->assertContains("Thank you for registering with {$siteName}.", $mock->mail->getBodyText()->getRawContent());
     $this->assertContains("From: {$siteName} <noreply@{$siteDomain}>", $mock->header);
     $this->assertContains("Subject: {$subject}", $mock->header);
     $this->assertContains("To: {$recipient}", $mock->header);
 }