public function testMarkerInterfaceForFileElement() { $this->element->setDecorators(array('ViewHelper')); $this->assertEquals(1, count($this->element->getDecorators())); try { $content = $this->element->render(new Zend_View()); $this->fail(); } catch (Zend_Form_Element_Exception $e) { $this->assertContains('No file decorator found', $e->getMessage()); } }
/** * @group ZF-10519 */ public function testCanChangeViewHelper() { $element = new Zend_Form_Element_File('foo'); $element->setView($this->getView()); // Get output using default view helper $defaultOutput = $element->render(); // Get output using mock view helper $element->helper = "formFileMock"; $mockOutput = $element->render(); // Ensure the view helper was changed $this->assertRegexp('/FormFileMock/s', $mockOutput); $this->assertNotEquals($defaultOutput, $mockOutput); }
/** * Render form element * * @param Zend_View_Interface $view * @return string */ public function render(Zend_View_Interface $view = null) { $this->setBootstrapConfiguration(); return $this->bsUtils->divFormGroup(parent::render($view)); }
<?php /* PHP 5.2.0 ZF 1.6.2 running this script throws the following in Zend_File_Transfer_Adapter_Abstract on my machine: PHP Notice: Undefined variable: result in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/File/Transfer/Adapter/Abstract.php on line 803 PHP Warning: Invalid argument supplied for foreach() in /Users/michel/web-lib/ZendFramework-1.6.2-minimal/library/Zend/Form/Element.php on line 524 */ // edit as required: set_include_path('/Users/michel/web-lib/ZendFramework-1.6.2-minimal/library'); require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); $element = new Zend_Form_Element_File('test'); $element->setDecorators(array('ViewHelper')); $element->setDestination('/tmp'); $element->clearFilters(); $element->render(new Zend_View());