$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'); $finder = new sfDoctrineFinder('DArticle'); $nbArticles = $finder->count(); $t->is($nbArticles, 0, 'delete() on an empty finder deletes all rows'); $article2 = new DArticle(); $article2->setTitle('foo2'); $article2->save(); $article3 = new DArticle(); $article3->setTitle('foo3'); $article3->save(); $finder = new sfDoctrineFinder('DArticle'); $nbDeleted = $finder->where('Title', 'foo2')->delete(); $t->is($nbDeleted, 1, 'delete() deletes all rows found by a finder'); $nbArticles = $finder->count(); $t->is($nbArticles, 1, 'delete() does not delete rows not found by the finder');