$t->info('WARNING: Doctrine_Connection_Sqlite_Exception caught.');
}
doctrine_refresh($a1);
$t->is($a1['category_id'], $categories[1]['id'], sprintf('"First item" has been moved to %s', $a3['Category']['name']));
$t->is($a1['position'], 3, '"First item" has been moved to "3" from "1"');
$t->info('Test deleting a collection of sortable items');
$d1 = new SortableArticleUniqueBy();
$d1->name = 'ArticleUniqueBy To Delete 1';
$d1->Category = $categories[2];
$d1->save();
$d2 = new SortableArticleUniqueBy();
$d2->name = 'ArticleUniqueBy To Delete 2';
$d2->Category = $categories[2];
$d2->save();
$d3 = new SortableArticleUniqueBy();
$d3->name = 'ArticleUniqueBy To Delete 3';
$d3->Category = $categories[2];
$d3->save();
$d4 = new SortableArticleUniqueBy();
$d4->name = 'ArticleUniqueBy To Delete 4';
$d4->Category = $categories[2];
$d4->save();
$collection = Doctrine::getTable('SortableArticleUniqueBy')->createQuery()->where('category_id = ?', $categories[2]['id'])->execute();
$t->is($collection->count(), 4, 'Three items exist in the Doctrine Collection to be deleted');
$collection->delete();
$t->is($collection->count(), 0, 'No items in collection - they have been deleted');
$t->ok(!$d1->exists(), '"ArticleUniqueBy To Delete 1" has been removed');
$t->ok(!$d2->exists(), '"ArticleUniqueBy To Delete 2" has been removed');
$t->ok(!$d3->exists(), '"ArticleUniqueBy To Delete 3" has been removed');
$t->ok(!$d4->exists(), '"ArticleUniqueBy To Delete 4" has been removed');