public function testCreateFromFileShouldLoadContentFromFile() { $root = vfsStream::setup(); $file = vfsStream::newFile('attachment.txt'); $file->setContent('FOO BAR. Test content'); $root->addChild($file); $attachment = Attachment::createFromFile($file->url(), 'text/plain'); $this->assertEquals('text/plain', $attachment->getContentType()); $this->assertEquals('attachment.txt', $attachment->getName()); $this->assertEquals('FOO BAR. Test content', $attachment->getContent()); }