Esempio n. 1
0
 public function testCanClearAllDisplayGroups()
 {
     $this->testCanAddAndRetrieveMultipleDisplayGroups();
     $this->form->clearDisplayGroups();
     $groups = $this->form->getDisplayGroups();
     $this->assertTrue(is_array($groups));
     $this->assertTrue(empty($groups));
 }
Esempio n. 2
0
 /**
  * @group ZF-10491
  * @group ZF-10734
  * @group ZF-10731
  */
 public function testAddElementToDisplayGroupByElementInstance()
 {
     $element = new Zend_Form_Element_Text('foo');
     $elementTwo = new Zend_Form_Element_Text('baz-----');
     $this->form->addElements(array($element, $elementTwo));
     $this->form->addDisplayGroup(array($element, $elementTwo), 'bar');
     $displayGroup = $this->form->getDisplayGroup('bar');
     $this->assertNotNull($displayGroup->getElement('foo'));
     $this->assertNotNull($displayGroup->getElement('baz'));
     // clear display groups and elements
     $this->form->clearDisplayGroups()->clearElements();
     $this->form->addDisplayGroup(array($element, $elementTwo), 'bar');
     $displayGroup = $this->form->getDisplayGroup('bar');
     $this->assertNotNull($displayGroup->getElement('foo'));
     $this->assertNotNull($displayGroup->getElement('baz'));
 }
Esempio n. 3
0
 public function testClearingAttachedItemsShouldNotCauseIterationToRaiseExceptions()
 {
     $form = new Zend_Form();
     $form->addElements(array('username' => 'text', 'password' => 'text'));
     $form->clearElements();
     try {
         foreach ($form as $item) {
         }
     } catch (Zend_Form_Exception $e) {
         $message = "Clearing elements prior to iteration should not cause iteration to fail;\n" . $e->getMessage();
         $this->fail($message);
     }
     $form->addElements(array('username' => 'text', 'password' => 'text'))->addDisplayGroup(array('username', 'password'), 'login');
     $form->clearDisplayGroups();
     try {
         foreach ($form as $item) {
         }
     } catch (Zend_Form_Exception $e) {
         $message = "Clearing display groups prior to iteration should not cause iteration to fail;\n" . $e->getMessage();
         $this->fail($message);
     }
     $subForm = new Zend_Form_SubForm();
     $form->addSubForm($subForm, 'foo');
     $form->clearSubForms();
     try {
         foreach ($form as $item) {
         }
     } catch (Zend_Form_Exception $e) {
         $message = "Clearing sub forms prior to iteration should not cause iteration to fail;\n" . $e->getMessage();
         $this->fail($message);
     }
 }