$t->is($catpeostyp['Main Author'], 'Main Author', 'Second sub-type is still well "Main Author"'); $t->info('Testing the sub-types with a given type'); $catpeostyp = Doctrine::getTable('CataloguePeople')->getDistinctSubType('author'); $t->is(count($catpeostyp), 6, 'With "author" type, we have "6" different subtypes'); $t->is($catpeostyp['Main Author'], 'Main Author', 'Only sub-type fetched is well "Main Author"'); $catpeostyp = Doctrine::getTable('CataloguePeople')->getDistinctSubType('expert'); $t->is(count($catpeostyp), 1, 'With "expert" type, we have "1" different subtypes'); $t->is($catpeostyp['General'], 'General', 'Only sub-type fetched is well "General"'); $t->info('Associating a new Author: "ML Duchesne"'); $author = new CataloguePeople(); $author->setReferencedRelation('taxonomy'); $author->setRecordId($taxon->getId()); $author->setPeopleType('author'); $author->setPeopleSubType('Main Author'); $author->setPeopleRef($person3->getId()); $author->setOrderBy(1); $author->save(); $t->info('ML Duchesne as Author associated'); $catpeo = Doctrine::getTable('CataloguePeople')->findForTableByType('taxonomy', $taxon->getId()); $t->is(count($catpeo['author']), 2, 'With author key: "2" record.'); $t->is($catpeo['author'][0]->getPeople()->getGivenName(), 'Poilux', 'Type author and first person well associated to "Poilux"'); $t->is($catpeo['author'][1]->getPeople()->getGivenName(), 'ML', 'Type author and second person well associated to "ML"'); $t->info('Interverting order of "Poilux Duchesne" and "ML Duchesne"'); $catpeo = Doctrine_Query::create()->from('CataloguePeople c')->orderBy('referenced_relation ASC, order_by ASC, id ASC')->execute(); Doctrine::getTable('CataloguePeople')->changeOrder($catpeo[1]->getReferencedRelation(), $catpeo[1]->getRecordId(), 'author', array($catpeo[3]->getId(), $catpeo[1]->getId())); $catpeo = Doctrine::getTable('CataloguePeople')->findForTableByType('taxonomy', $taxon->getId()); $t->is($catpeo['author'][0]->getPeople()->getGivenName(), 'ML', 'Type author and first person well associated to "ML"'); $t->is($catpeo['author'][1]->getPeople()->getGivenName(), 'Poilux', 'Type author and second person well associated to "Poilux"'); $t->info('Testing the getPeopleRelated method'); $specimen = Doctrine::getTable('Specimens')->findOneByTaxonRef($taxon->getId()); $identification = new Identifications();