$t->isa_ok($article, 'DArticle', 'A finder instanciated directly with a Record class returns the correct objects'); $t->is($article->getTitle(), 'foo', 'A finder instanciated directly with a Record class returns the correct objects'); $finder = new sfDoctrineFinder(); $finder->setClass('DArticle'); $t->is($finder->getClass(), 'DArticle', 'setClass() and getClass() are accesors to the protected $class property'); $article = $finder->findOne(); $t->isa_ok($article, 'DArticle', 'A finder instanciated directly with a Record class returns the correct objects'); $t->is($article->getTitle(), 'foo', 'A finder can be instanciated without parameter, and initialized later after defining its class'); $articles = sfDoctrineFinder::from('DArticle')->find(); $t->is(count($articles), 3, 'from() allows direct chaining of conditions'); class DArticleFinder extends sfDoctrineFinder { protected $class = 'DArticle'; } $finder = new DArticleFinder(); $article = $finder->findOne(); $t->isa_ok($article, 'DArticle', 'A finder extending sfDoctrineFinder can be used directly if defining the $class property'); $finder = new DArticleFinder(); $articles = $finder->find(); $t->is(count($articles), 3, 'A finder extending sfDoctrineFinder can be used directly if defining the $class property'); Doctrine_Query::create()->delete()->from('DArticle')->execute(); Doctrine_Query::create()->delete()->from('DCategory')->execute(); $category1 = new DCategory(); $category1->setName('cat1'); $category1->save(); $category2 = new DCategory(); $category2->setName('cat2'); $category2->save(); $article1 = new DArticle(); $article1->setTitle('aaaaa'); $article1->setCategory($category1);