Esempio n. 1
0
 public function testFromAccessors()
 {
     $this->iniSet('sendmail_from', '');
     $mail = new \r8\Mail($this->getTestTransport());
     $this->assertFalse($mail->fromExists());
     $this->assertNull($mail->getFrom());
     $this->assertFalse($mail->fromNameExists());
     $this->assertNull($mail->getFromName());
     $this->assertSame($mail, $mail->setFrom("*****@*****.**"));
     $this->assertTrue($mail->fromExists());
     $this->assertSame("*****@*****.**", $mail->getFrom());
     $this->assertFalse($mail->fromNameExists());
     $this->assertNull($mail->getFromName());
     $this->assertSame($mail, $mail->clearFrom());
     $this->assertFalse($mail->fromExists());
     $this->assertNull($mail->getFrom());
     $this->assertFalse($mail->fromNameExists());
     $this->assertNull($mail->getFromName());
     $this->assertSame($mail, $mail->setFrom("Name" . chr(220) . "@Example.net", "Label"));
     $this->assertTrue($mail->fromExists());
     $this->assertSame("*****@*****.**", $mail->getFrom());
     $this->assertTrue($mail->fromNameExists());
     $this->assertSame("Label", $mail->getFromName());
     $this->assertSame($mail, $mail->setFrom("*****@*****.**"));
     $this->assertTrue($mail->fromExists());
     $this->assertSame("*****@*****.**", $mail->getFrom());
     $this->assertTrue($mail->fromNameExists());
     $this->assertSame("Label", $mail->getFromName());
     try {
         $this->assertSame($mail, $mail->setFrom("  "));
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\Data $err) {
         $this->assertSame("Email Address must not be empty", $err->getMessage());
     }
 }