/** * @param Comment $entity * * @return array */ protected function getAttachmentInfo(Comment $entity) { $result = []; $attachment = $this->getAttachment($entity); if ($attachment) { $result = ['attachmentURL' => $this->getAttachmentURL($entity, $attachment), 'attachmentSize' => $this->attachmentManager->getFileSize($attachment->getFileSize()), 'attachmentFileName' => $attachment->getOriginalFilename()]; } return $result; }
/** * @dataProvider getData */ public function testGetFileSize($value, $expected) { $this->assertEquals($expected, $this->attachmentManager->getFileSize($value)); }
/** * Get human readable file size * * @param integer $bytes * @return string */ public function getFileSize($bytes) { return $this->manager->getFileSize($bytes); }