$exceptionThrown = false;
} 
catch (Exception $e) 
{
  $exceptionThrown = true;
}
$t->is($exceptionThrown, false, 'guessRelation() can find a relation when the foreign phpName is not the camelCase version of the foreign Tablename');


/*********************************************************/
/* sfPropelFinderRelationManager::addRelationFromClass() */
/*********************************************************/

$t->diag('sfPropelFinderRelationManager::addRelationFromClass()');

$manager = new sfPropelFinderRelationManager('Article');

$ret = $manager->addRelationFromClass('Comment');
$t->isa_ok($ret, 'sfPropelFinderRelation', 'addRelationFromClass() returns a relation object when a relationship is added');
$relations = $manager->getRelations();
$t->is(count($relations), 1, 'addRelationFromClass() adds the relation to the manager relations array');
$keys = array_keys($relations);
$t->is(array_pop($keys), 'Comment', 'addRelationFromClass() adds the relation using the related class as an index');

$ret = $manager->addRelationFromClass('Author');
$relations = $manager->getRelations();
$t->is(count($relations), 2, 'addRelationFromClass() adds the relation to the manager relations array');
$keys = array_keys($relations);
$t->is(array_pop($keys), 'Author', 'addRelationFromClass() adds the relation using the related class as an index');

$ret = $manager->addRelationFromClass('Author');
$ownerRelation->relateObject($house1, $human1);
$t->is($house1->getOwnerId(), $human1->getId(), 'relateObject() creates a relation between two Propel objects');
$civilityRelation->relateObject($house1, $civility1);
$t->is($human1->getTheSex(), $civility1->getId(), 'relateObject() creates a relation between two Propel objects via another relation');

/******************************************************/
/* sfPropelFinderRelation::relateObject() and aliases */
/******************************************************/

$t->diag('sfPropelFinderRelation::relateObject() and aliases');

HumanPeer::doDeleteAll();
$human1 = new Human();
$human1->setName('John');
$human1->save();
$human2 = new Human();
$human2->setName('Albert');
$human2->save();
$human3 = new Human();
$human3->setName('Jane');
$human3->save();

$manager = new sfPropelFinderRelationManager('Human');
$fatherRelation = $manager->addRelationFromColumns('Human', HumanPeer::FATHER_ID, 'Human', HumanPeer::ID, 'father');
$grandFatherRelation = $manager->addRelationFromColumns('father', HumanPeer::FATHER_ID, 'Human', HumanPeer::ID, 'grandFather');

$fatherRelation->relateObject($human3, $human2);
$t->is($human3->getFatherId(), $human2->getId(), 'relateObject() creates a relation between two Propel objects');
$grandFatherRelation->relateObject($human3, $human1);
$t->is($human2->getFatherId(), $human1->getId(), 'relateObject() creates a relation between two Propel objects via another relation');