$vot = OppVotazionePeer::retrieveByPK(9900); $vot_att = new OppVotazioneHasAtto(); $vot_att->setOppVotazione($vot); $vot_att->setOppAtto($obj); $vot_att->save(); $related_news = getRelatedNews($obj); $n_related_news = count($related_news); $t->ok($n_related_news == 3, 'Now there are two more news related to the act'); dumpNews($t, "news related to the act", $related_news); $t->diag('Test if group news were created'); $seduta = $vot->getOppSeduta(); $data = $seduta->getData(); $ramo = $seduta->getRamo(); $t->ok(NewsPeer::hasGroupVotation($data, $ramo, $obj->getOppTipoAtto()->getId()) == true, 'Group news of Home rilevance'); $t->ok(NewsPeer::hasGroupVotation($data, $ramo, $obj->getOppTipoAtto()->getId()) == true, 'Group news of List relevance'); $t->ok(NewsPeer::hasGroupVotation($data, $ramo, $obj->getOppTipoAtto()->getId(), $obj->getId()) == true, 'Group news, of Single relevance, related to the act'); $t->diag('Create another non-final votation on the same act, the same day'); $vot = OppVotazionePeer::retrieveByPK(9901); $vot_att = new OppVotazioneHasAtto(); $vot_att->setOppVotazione($vot); $vot_att->setOppAtto($obj); $vot_att->save(); $related_news = getRelatedNews($obj); $n_related_news = count($related_news); $t->ok($n_related_news == 4, 'Now there is a news more'); dumpNews($t, "news related to the act", $related_news); $t->diag('Create a final votation, the same day'); $vot = OppVotazionePeer::retrieveByPK(9925); $vot_att = new OppVotazioneHasAtto(); $vot_att->setOppVotazione($vot); $vot_att->setOppAtto($obj);