{
  $t->fail('Relations lookup work also on finder children objects');
}

$t->diag('sfDoctrineFinder::with() and left joins');

Doctrine_Query::create()->delete()->from('DComment')->execute();
Doctrine_Query::create()->delete()->from('DArticle')->execute();
Doctrine_Query::create()->delete()->from('DCategory')->execute();

$category1 = new DCategory();
$category1->setName('cat1');
$category1->save();
$article1 = new DArticle();
$article1->setTitle('aaa');
$article1->setCategory($category1);
$article1->save();
$article2 = new DArticle();
$article2->setTitle('bbb');
$article2->save();

$article = sfDoctrineFinder::from('DArticle')->leftJoin('DCategory')->with('DCategory')->findLast();
$category = $article->getCategory();
if (is_object($category))
{
  $t->isa_ok($article->getCategory(), 'Doctrine_Null', 'In a left join using with(), empty related objects are not hydrated');
}
else
{
  $t->isa_ok($article->getCategory(), 'NULL', 'In a left join using with(), empty related objects are not hydrated');
}