} $t->diag('count()'); Doctrine_Query::create()->delete()->from('DArticle')->execute(); $finder = new sfDoctrineFinder('DArticle'); $nbArticles = $finder->count(); $t->isa_ok($nbArticles, 'integer', 'count() returns an integer'); $t->is($nbArticles, 0, 'count() returns 0 on empty tables'); $article2 = new DArticle(); $article2->setTitle('foo2'); $article2->save(); $article3 = new DArticle(); $article3->setTitle('foo3'); $article3->save(); $nbArticles = $finder->count(); $t->is($nbArticles, 2, 'count() returns the number of records matching the condition'); $nbArticles = $finder->whereTitle('foo2')->count(); $t->is($nbArticles, 1, 'count() returns the number of records matching the condition'); $t->diag('delete()'); Doctrine_Query::create()->delete()->from('DArticle')->execute(); $finder = new sfDoctrineFinder('DArticle'); $nbDeleted = $finder->delete(); $t->is($nbDeleted, 0, 'delete() on an empty finder with no results returns 0'); $article2 = new DArticle(); $article2->setTitle('foo2'); $article2->save(); $article3 = new DArticle(); $article3->setTitle('foo3'); $article3->save(); $finder = new sfDoctrineFinder('DArticle'); $nbDeleted = $finder->delete(); $t->is($nbDeleted, 2, 'delete() deletes records from the table and returns the number of deleted rows');