コード例 #1
0
 /**
  * Setting the filename should set the description first.
  */
 public function testSettingFileNameResetsDescription()
 {
     $attachment = new Swift_Message_Attachment("some string", "my_file.txt");
     $attachment->setDescription("another_file.txt");
     $this->assertEqual("another_file.txt", $attachment->getDescription());
     $attachment->setFileName("zip.button");
     $this->assertEqual("zip.button", $attachment->getDescription());
     $structure = $attachment->build()->readFull();
     $this->assertPattern("~Content-Type: application/octet-stream;\\s* name=(\"?)(zip\\.button)\\1\r\nContent-Transfer-Encoding: base64\r\n" . "Content-Description: \\2\r\nContent-Disposition: attachment;\\s* filename=(\"?)\\2\\3\r\n\r\n.*~s", $structure);
 }