$t->diag('Cleaning record ' . get_class($rec) . "(" . $rec->getId() . ")"); $rec->delete(); } $c = new Criteria(); $c->add(OppPoliticoPeer::ID, 999999); $existing_records = OppPoliticoPeer::doSelect($c); foreach ($existing_records as $rec) { $t->diag('Cleaning record ' . get_class($rec) . "(" . $rec->getId() . ")"); $rec->delete(); } $t->diag('Create the test act object'); $obj = new OppAtto(); $obj->setTipoAttoId(1); $obj->setParlamentoId(999999); $obj->setRamo('S'); $obj->setNumFase(914); $obj->setDataPres('2008-11-01'); $obj->setDescrizione("Una descrizione di prova"); $obj->save(); $related_news = getRelatedNews($obj); $n_related_news = count($related_news); $first_news = $related_news[0]; $t->ok($n_related_news == 1, 'One news related to the act was generated'); dumpNews($t, "news related to the act", $related_news); $t->diag('Create a non-final votation: two more news expected (group and detail)'); $vot = OppVotazionePeer::retrieveByPK(9900); $vot_att = new OppVotazioneHasAtto(); $vot_att->setOppVotazione($vot); $vot_att->setOppAtto($obj); $vot_att->save(); $related_news = getRelatedNews($obj);