/**
  * Test that the expected template is rendered using the given parameters array.
  */
 public function testRenderTemplate()
 {
     $renderParams = array('param1' => true, 'param2' => false);
     $mockTemplating = $this->getMockBuilder('Symfony\\Bundle\\TwigBundle\\TwigEngine')->disableOriginalConstructor()->getMock();
     $mockTemplating->expects($this->once())->method('render')->with('ReskumeFileBundle:template:upload_attachment.html.twig', $renderParams)->willReturn('renderedTemplateContent');
     $renderer = new AttachmentUploadRenderer($mockTemplating);
     $renderer->renderTemplate($renderParams);
 }
 /**
  * @return string
  */
 private function renderResponseContent()
 {
     if (empty($this->uploadedFile) || $this->error) {
         return null;
     }
     $metaArr = array();
     $thumbHelper = new ThumbnailHelper($this->configuration, $this->entityManager);
     foreach ($this->uploadedFile as $file) {
         $basename = $file->getBaseName();
         $tmpPathname = $file->getPathname();
         $thumbFile = $thumbHelper->createScaledThumb($tmpPathname, 50);
         $base64Thumb = $thumbHelper->getBase64Thumb($thumbFile);
         $this->attachmentIndex++;
         // @important increment by one
         $metaArr[$basename] = array('key' => $this->attachmentIndex, 'tmpPathname' => $tmpPathname, 'origFilename' => $this->uploadedFile[$basename]->getClientOriginalName(), 'thumbnail' => $base64Thumb);
     }
     return $this->uploadRenderer->renderTemplate(array('formName' => $this->formName, 'formId' => $this->formId, 'metadata' => $metaArr));
 }