/** * @test */ public function getAttachmentsWithTwoAttachmentsReturnsTwoAttachments() { $attachment = new Tx_Oelib_Attachment(); $attachment->setFileName('test.txt'); $attachment->setContentType('text/plain'); $attachment->setContent('Test'); $this->subject->addAttachment($attachment); $otherAttachment = new Tx_Oelib_Attachment(); $otherAttachment->setFileName('second_test.txt'); $otherAttachment->setContentType('text/plain'); $otherAttachment->setContent('Second Test'); $this->subject->addAttachment($otherAttachment); self::assertSame(array($attachment, $otherAttachment), $this->subject->getAttachments()); }
/** * @test */ public function sendCanAddTwoAttachments() { $sender = new Tx_Oelib_Tests_Unit_Fixtures_TestingMailRole('', '*****@*****.**'); $recipient = new Tx_Oelib_Tests_Unit_Fixtures_TestingMailRole('John Doe', $this->email['recipient']); $eMail = new Tx_Oelib_Mail(); $eMail->setSender($sender); $eMail->addRecipient($recipient); $eMail->setSubject($this->email['subject']); $eMail->setMessage($this->email['message']); $attachment1 = new Tx_Oelib_Attachment(); $attachment1->setFileName(t3lib_extMgm::extPath('oelib', 'Tests/Unit/Fixtures/test.txt')); $attachment1->setContentType('text/plain'); $eMail->addAttachment($attachment1); $attachment2 = new Tx_Oelib_Attachment(); $attachment2->setFileName(t3lib_extMgm::extPath('oelib', 'Tests/Unit/Fixtures/test_2.css')); $attachment2->setContentType('text/css'); $eMail->addAttachment($attachment2); $this->subject->send($eMail); $children = $this->subject->getFirstSentEmail()->getChildren(); self::assertSame(2, count($children)); }