示例#1
0
 public function testPopulateFromModel()
 {
     $this->useEnglish();
     $form = new Admin_Form_Person();
     $person = new Opus_Person();
     $person->setFirstName('John');
     $person->setLastName('Doe');
     $person->setAcademicTitle('PhD');
     $person->setPlaceOfBirth('Berlin');
     $datesHelper = $form->getDatesHelper();
     $person->setDateOfBirth($datesHelper->getOpusDate('1990/01/01'));
     $person->setEmail('*****@*****.**');
     $person->setIdentifierGnd('1234');
     $person->setIdentifierOrcid('3456');
     $person->setIdentifierMisc('5678');
     $person->store();
     $form->populateFromModel($person);
     $personId = $person->getId();
     $person->delete();
     $this->assertEquals($personId, $form->getElement('PersonId')->getValue());
     $this->assertEquals($person->getLastName(), $form->getElement('LastName')->getValue());
     $this->assertEquals($person->getFirstName(), $form->getElement('FirstName')->getValue());
     $this->assertEquals($person->getAcademicTitle(), $form->getElement('AcademicTitle')->getValue());
     $this->assertEquals($person->getEmail(), $form->getElement('Email')->getValue());
     $this->assertEquals($person->getPlaceOfBirth(), $form->getElement('PlaceOfBirth')->getValue());
     $this->assertEquals('1990/01/01', $form->getElement('DateOfBirth')->getValue());
     $this->assertEquals($form->getElement('IdentifierGnd')->getValue(), '1234');
     $this->assertEquals($form->getElement('IdentifierOrcid')->getValue(), '3456');
     $this->assertEquals($form->getElement('IdentifierMisc')->getValue(), '5678');
 }
 public function setUp()
 {
     parent::setUp();
     $document = $this->createTestDocument();
     $document->setServerState('published');
     $document->setType('baz');
     $title = new Opus_Title();
     $title->setValue('foobartitle');
     $document->setTitleMain($title);
     $this->documentId = $document->store();
     $this->assertNotNull($this->documentId);
     $document = $this->createTestDocument();
     $document->setServerState('published');
     $document->setType('baz');
     $title = new Opus_Title();
     $title->setValue('foobartitle');
     $document->setTitleMain($title);
     $author = new Opus_Person();
     $author->setFirstName('John');
     $author->setLastName('Doe');
     $author->setEmail('*****@*****.**');
     $this->authorId = $author->store();
     $this->assertNotNull($this->authorId);
     $link_person = $document->addPersonAuthor($author);
     $link_person->setAllowEmailContact('1');
     $this->authorDocumentId = $document->store();
     $this->assertNotNull($this->authorDocumentId);
 }
示例#3
0
 public function setUp()
 {
     parent::setUp();
     $document = $this->createTestDocument();
     $document->setServerState('published');
     $document->setType('testtype');
     $title = new Opus_Title();
     $title->setValue('testtitle');
     $document->setTitleMain($title);
     $author1 = new Opus_Person();
     $author1->setFirstName('John');
     $author1->setLastName('Doe');
     $author1->setEmail('*****@*****.**');
     $this->author1Id = $author1->store();
     $link_person1 = $document->addPersonAuthor($author1);
     $link_person1->setAllowEmailContact('1');
     $author2 = new Opus_Person();
     $author2->setFirstName('Jane');
     $author2->setLastName('Doe');
     $this->author2Id = $author2->store();
     $link_person2 = $document->addPersonAuthor($author2);
     $link_person2->setAllowEmailContact('0');
     $author3 = new Opus_Person();
     $author3->setFirstName('Jimmy');
     $author3->setLastName('Doe');
     $this->author3Id = $author3->store();
     $link_person3 = $document->addPersonAuthor($author3);
     $link_person3->setAllowEmailContact('1');
     $author4 = new Opus_Person();
     $author4->setFirstName('Foo');
     $author4->setLastName('Bar');
     $author4->setEmail('*****@*****.**');
     $this->author4Id = $author4->store();
     $link_person4 = $document->addPersonAuthor($author4);
     $link_person4->setAllowEmailContact('1');
     $this->documentId = $document->store();
     $this->assertNotNull($this->documentId);
     $this->assertNotNull($this->author1Id);
     $this->assertNotEquals('', $this->author1Id);
     $this->assertNotNull($this->author2Id);
     $this->assertNotEquals('', $this->author2Id);
     $this->assertNotNull($this->author3Id);
     $this->assertNotEquals('', $this->author3Id);
     $this->assertNotNull($this->author4Id);
     $this->assertNotEquals('', $this->author4Id);
     $document = $this->createTestDocument();
     $document->setServerState('unpublished');
     $this->unpublishedDocumentId = $document->store();
     $this->assertNotNull($this->unpublishedDocumentId);
 }
$editor = new Opus_Person();
$editor->setFirstName('Bob' . randString($counter++));
$editor->setLastName('Foster' . randString($counter++));
$doc->addPersonEditor($editor);
$advisor = new Opus_Person();
$advisor->setFirstName('Fred' . randString($counter++));
$advisor->setLastName('Clever' . randString($counter++));
$doc->addPersonAdvisor($advisor);
$translator = new Opus_Person();
$translator->setFirstName('Erika' . randString($counter++));
$translator->setLastName('Fuchs' . randString($counter++));
$doc->addPersonTranslator($translator);
$contributor = new Opus_Person();
$contributor->setFirstName('Jeff' . randString($counter++));
$contributor->setLastName('Smart' . randString($counter++));
$contributor->store();
$doc->addPersonContributor($contributor);
//
// Titles
//
foreach (array('addTitleMain', 'addTitleAbstract', 'addTitleParent', 'addTitleSub', 'addTitleAdditional') as $titleMethod) {
    $doc->{$titleMethod}()->setValue(randString($counter++))->setLanguage(randString($counter++));
    $doc->{$titleMethod}()->setValue(randString($counter++))->setLanguage('deu');
    $doc->{$titleMethod}()->setValue(randString($counter++))->setLanguage('eng');
}
//
// Collections
//
$institutesRole = new Opus_CollectionRole();
$institutesRole->setName('institutes' . randString($counter++) . rand())->setOaiName('institutes' . randString($counter++) . rand())->setPosition(1)->setVisible(1)->setVisibleBrowsingStart(1)->setDisplayBrowsing('Name')->setVisibleFrontdoor(1)->setDisplayFrontdoor('Name')->setVisibleOai('Name')->setDisplayOai('Name')->store();
$instituteName = 'Institut für empirische Forschung ' . randString($counter++);