Пример #1
0
 public function testSubformsAppearInOrderOfObjects()
 {
     $form = new Admin_Form_Document_MultiSubForm('Admin_Form_Document_Identifier', 'Identifier');
     $doc = new Opus_Document(146);
     $identifiers = $doc->getIdentifier();
     $form->populateFromModel($doc);
     $this->assertEquals(count($identifiers), count($form->getSubForms()));
     $index = 0;
     foreach ($form->getSubForms() as $name => $subform) {
         $this->assertEquals($identifiers[$index]->getId(), $subform->getElement('Id')->getValue(), "Subform {$name} should habe been at position {$index}.");
         $index++;
     }
 }
Пример #2
0
 /**
  * Prueft, dass bei gesetztem Id-Element, der Identifier mit dieser Id und aktualisierten Werten zurueck geliefert
  * wird.
  */
 public function testGetModelExistingIdentifier()
 {
     $form = new Admin_Form_Document_Identifier();
     $document = new Opus_Document(146);
     $identifiers = $document->getIdentifier();
     $identifierId = $identifiers[0]->getId();
     $form->getElement('Id')->setValue($identifierId);
     $form->getElement('Type')->setValue('url');
     $form->getElement('Value')->setValue('test-urn-1');
     $identifier = $form->getModel();
     $this->assertEquals($identifierId, $identifier->getId());
     $this->assertEquals('url', $identifier->getType());
     $this->assertEquals('test-urn-1', $identifier->getValue());
 }