public function createNewModel() { $model = new Opus_DnbInstitute(); $model->setName('TestName'); $model->setCity('TestCity'); $model->setDepartment('TestDepartment'); $model->setAddress('TestAddress'); $model->setPhone('TestPhone'); $model->setDnbContactId('TestDnbContactId'); $model->setIsGrantor(true); $model->setIsPublisher(false); return $model->store(); }
public function testPopulateFromModel() { $form = new Admin_Form_DnbInstitute(); $model = new Opus_DnbInstitute(); $model->setName('TestName'); $model->setDepartment('TestDepartment'); $model->setAddress('TestAddress'); $model->setCity('TestCity'); $model->setPhone('TestPhone'); $model->setDnbContactId('TestDnbContactId'); $model->setIsGrantor(true); $model->setIsPublisher(false); $form->populateFromModel($model); $this->assertEquals('TestName', $form->getElement('Name')->getValue()); $this->assertEquals('TestDepartment', $form->getElement('Department')->getValue()); $this->assertEquals('TestAddress', $form->getElement('Address')->getValue()); $this->assertEquals('TestCity', $form->getElement('City')->getValue()); $this->assertEquals('TestPhone', $form->getElement('Phone')->getValue()); $this->assertEquals('TestDnbContactId', $form->getElement('DnbContactId')->getValue()); $this->assertTrue($form->getElement('IsGrantor')->getValue()); $this->assertEquals('0', $form->getElement('IsPublisher')->getValue()); $this->assertNull($form->getElement('Id')->getValue()); }