Ejemplo n.º 1
0
 public function getnahoWikiContent($con = null)
 {
     if ($this->anahoWikiContent === null && $this->content_id !== null) {
         include_once 'plugins/nahoWikiPlugin/lib/model/om/BasenahoWikiContentPeer.php';
         $this->anahoWikiContent = nahoWikiContentPeer::retrieveByPK($this->content_id, $con);
     }
     return $this->anahoWikiContent;
 }
$prefix = sfConfig::get(sprintf('propel_behavior_wikifiableBehavior_%s_prefix', get_class($obj_votazione)));
$t->ok($prefix == 'votazione', 'The prefix was correctly read from the behavior configuration');
$wiki_page = nahoWikiPagePeer::retrieveByName($prefix . "_" . $obj_votazione->getId());
$t->ok($wiki_page instanceof nahoWikiPage, 'a wiki page was just created for this object');
$c = new Criteria();
$c->add(nahoWikiRevisionPeer::REVISION, 1);
$wiki_revisions = $wiki_page->getRevisions($c);
$wiki_revision = $wiki_revisions[0];
$t->ok(count($wiki_revisions) == 1 && $wiki_revision instanceof nahoWikiRevision, 'a wiki revision was added');
$wiki_content = $wiki_revision->getnahoWikiContent();
$t->ok($wiki_content instanceof nahoWikiContent, 'a wiki content was also added');
$t->ok($wiki_revision->getComment() == 'Creazione Automatica' && $wiki_revision->getContent() == 'Descrizione wiki, a cura degli utenti.', 'comment and content were correctly inserted');
$votazione_page_id = $wiki_page->getId();
$votazione_revision_num = $wiki_revision->getRevision();
$votazione_content_id = $wiki_content->getId();
$t->diag('Remove the act object');
$obj_atto->delete();
$wiki_page = nahoWikiPagePeer::retrieveByPK($atto_page_id);
$t->ok(!$wiki_page instanceof nahoWikiPage, 'the wiki page was removed');
$wiki_revision = nahoWikiRevisionPeer::retrieveByPK($atto_page_id, $atto_revision_num, $atto_content_id);
$t->ok(!$wiki_revision instanceof nahoWikiRevision, 'the wiki revision was removed');
$wiki_content = nahoWikiContentPeer::retrieveByPK($atto_content_id);
$t->ok($wiki_content instanceof nahoWikiContent, 'the wiki content was NOT removed');
$t->diag('Remove the votation object');
$obj_votazione->delete();
$wiki_page = nahoWikiPagePeer::retrieveByPK($votazione_page_id);
$t->ok(!$wiki_page instanceof nahoWikiPage, 'the wiki page was removed');
$wiki_revision = nahoWikiRevisionPeer::retrieveByPK($votazione_page_id, $votazione_revision_num, $votazione_content_id);
$t->ok(!$wiki_revision instanceof nahoWikiRevision, 'the wiki revision was removed');
$wiki_content = nahoWikiContentPeer::retrieveByPK($votazione_content_id);
$t->ok($wiki_content instanceof nahoWikiContent, 'the wiki content was NOT removed');