public function testGetLabel() { $this->useEnglish(); Zend_Registry::get('Zend_Translate')->loadModule('admin'); $element = new Application_Form_Element_FileHash('filehash'); $file = new Opus_File(116); $hashes = $file->getHashValue(); $hash = $hashes[0]; $this->assertEquals('MD5', $hash->getType()); $element->setValue($hash); $element->setFile($file); $this->assertEquals('Checksum - MD5', $element->getLabel()); }
public function testRenderWithFileTooBig() { $config = Zend_Registry::get('Zend_Config'); $config->merge(new Zend_Config(array('checksum' => array('maxVerificationSize' => '0')))); $element = new Application_Form_Element_FileHash('name'); $file = new Opus_File(116); $hashes = $file->getHashValue(); $hash = $hashes[0]; $element->setValue($hash); $element->setFile($file); $decorator = new Application_Form_Decorator_FileHash(); $decorator->setElement($element); $output = $decorator->render('content'); $this->assertEquals('content' . '<div class="textarea hashsoll"><span class="hash-label">Expected:</span>1ba50dc8abc619cea3ba39f77c75c0fe</div>' . '<input type="hidden" name="name[Soll]" value="1ba50dc8abc619cea3ba39f77c75c0fe" id="name-Soll" />' . '<div class="textarea hashist"><span class="hash-label">Actual:</span>' . Zend_Registry::get('Zend_Translate')->translate('frontdoor_file_too_big') . '</div>', $output); }