attachTo($email); $attachments = $email->getAttachments(); $this->assertCount(1, $attachments); $this->assertSame('invoice.pdf', $attachments[0]->getFilename()); $this->assertSame('application/pdf', $attachments[0]->getMediaType().'/'.$attachments[0]->getMediaSubtype()); } finally { unlink($tmpFile); } } public function testDefaultMimeTypeIsApplicationPdf(): void { $dto = new EmailPathAttachmentDto('/tmp/test.pdf', 'test.pdf'); $this->assertSame('application/pdf', $dto->getMimeType()); } public function testCustomMimeType(): void { $dto = new EmailPathAttachmentDto('/tmp/test.csv', 'test.csv', 'text/csv'); $this->assertSame('text/csv', $dto->getMimeType()); } public function testGettersReturnConstructorValues(): void { $dto = new EmailPathAttachmentDto('/var/uploads/file.pdf', 'document.pdf', 'application/pdf'); $this->assertSame('/var/uploads/file.pdf', $dto->getPath()); $this->assertSame('document.pdf', $dto->getName()); $this->assertSame('application/pdf', $dto->getMimeType()); } }