Exemple #1
0
function assertContentPatch($server, $patchId, $clock, $pageName, $op, $previousPatch)
{
    $patchName = substr($patchId, 0, -strlen($clock - 1));
    $patch = getSemanticRequest($server, '[[patchID::' . $patchId, '-3FonPage/-3FhasOperation/-3Fprevious');
    PHPUnit_Framework_Assert::assertEquals($pageName, $patch[0]);
    if (strtolower(substr($patch[2], 0, strlen('Patch:'))) == 'patch:') {
        $patch[2] = substr($patch[2], strlen('patch:'));
    }
    PHPUnit_Framework_Assert::assertEquals(strtolower($previousPatch), strtolower(substr($patch[2], 0, -1)), 'Previous patch on patch ' . $patchId . ' must be but is ' . $patch[2]);
    $opFound = explode(',', $patch[1]);
    PHPUnit_Framework_Assert::assertTrue(count($op[$pageName]) == count($opFound), 'Patch ' . $patchId . ' must contains ' . count($op[$pageName]) . ' operations but ' . count($opFound) . ' operations were found');
    for ($j = 0; $j < count($opFound); $j++) {
        $o = str_replace(' ', '', $opFound[$j]);
        $opi = explode(';', $o);
        PHPUnit_Framework_Assert::assertEquals(strtolower(substr($patchName . $clock, strlen('patch:'))), strtolower($opi[0]), 'Operation id on patch ' . $patchId . ' must be ' . $patchName . $clock . ' but ' . strtolower($opi[0]) . ' was found');
        $a = strtolower($op[$pageName][$j][strtolower($opi[1])]);
        $b = strtolower(utils::contentDecoding($opi[3]));
        PHPUnit_Framework_Assert::assertEquals(strtolower($op[$pageName][$j][strtolower($opi[1])]), strtolower(utils::contentDecoding($opi[3])));
        $clock = $clock + 1;
    }
}
    public function testPull()
    {
        // create pushFeed on wiki1
        $pushName = 'pushCity';
        $pushContent = 'PushFeed:
[[name::pushCity]]
[[hasSemanticQuery::-5B-5BCategory:city-5D-5D]]
[[hasPushHead::ChangeSet:testCS1Pull]]';
        $this->assertTrue($this->p2pBot1->createPage('PushFeed:' . $pushName, $pushContent), 'failed on create page pushCity (' . $this->p2pBot1->bot->results . ')');
        $CSName = 'testCS1Pull';
        $CSContent = '[[changeSetID::TestCS1Pull]]
[[inPushFeed::PushFeed:pushCity]]
[[previousChangeSet::none]]
[[hasPatch::Patch:testpatch1]]';
        $this->assertTrue($this->p2pBot1->createPage('ChangeSet:' . $CSName, $CSContent), 'failed on create page testCS1Pull (' . $this->p2pBot1->bot->results . ')');
        $patchName = 'Testpatch1';
        $patchContent = 'Patch: patchID: [[patchID::Patch:Testpatch1]]
 onPage: [[onPage::Pouxeux]]  hasOperation: [[hasOperation::op;test;(55:5ed);test]] previous: [[previous::none]] [[siteID::id1]]';
        $this->assertTrue($this->p2pBot1->createPage('Patch:' . $patchName, $patchContent), 'failed on create page testPatch1 (' . $this->p2pBot1->bot->results . ')');
        // create pull on wiki2
        $pullName = 'pullCityonWiki1';
        $pullContent = '[[name::PullFeed:pullCityonWiki1]]
[[pushFeedServer::' . $this->wiki1 . ']]
[[pushFeedName::PushFeed:' . $pushName . ']] [[hasPullHead::none]]';
        exec('rm ../cache/*');
        $this->p2pBot2->bot->wikiConnected = false;
        $this->assertTrue($this->p2pBot2->createPage('PullFeed:' . $pullName, $pullContent), 'failed on create pull (' . $this->p2pBot2->bot->results . ')');
        // pull
        $this->assertTrue($this->p2pBot2->pull('PullFeed:' . $pullName), 'error on pull ' . $pullName . '(' . $this->p2pBot2->bot->results . ')');
        assertPageExist($this->p2pBot2->bot->wikiServer, 'ChangeSet:' . $CSName);
        assertPageExist($this->p2pBot2->bot->wikiServer, 'Patch:' . $patchName);
        $pullHead = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[name::PullFeed:' . $pullName . ']]', '-3FhasPullHead');
        $this->assertEquals(strtolower($CSName), strtolower($pullHead[0]));
        // pull without update
        $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'));
        $this->assertTrue($this->p2pBot2->pull('PullFeed:' . $pullName), 'error on pull ' . $pullName . '(' . $this->p2pBot2->bot->results . ')');
        $countCSAfter = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'));
        $pullFound = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[name::PullFeed:' . $pushName . ']]', '-3FhasPullHead');
        $this->assertEquals(strtolower($CSIDFound), strtolower(substr($pushFound[0], 0, -1)), 'failed to push ' . $pushName . ' pushHead must be ' . $CSIDFound . ' but ' . $pushFound[0] . ' was found');
        $this->assertTrue($countCS == $countCSAfter);
    }
 /**
  * Create one page, push it
  * pull it on wiki2 and on wiki3
  * modify the page on wiki2 and wiki3
  * pull both on wiki1
  * wiki1 must have the good page on local
  */
 public function testSimple2()
 {
     $this->testSimple1();
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // assert page Ours exist on wiki2
     assertPageExist($this->p2pBot2->bot->wikiServer, $this->pageName);
     // create pull on wiki3
     $this->assertTrue($this->p2pBot3->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot3->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot3->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot3->bot->results . ')');
     // assert page Ours exist on wiki3
     assertPageExist($this->p2pBot3->bot->wikiServer, $this->pageName);
     $addContent2 = "Les caractéristiques communes des ours modernes\nsont un grand corps trapu et massif, un long museau,\nun pelage hirsutes, des pattes plantigrades à cinq griffes\nnon rétractiles, et une queue courte.";
     $this->assertTrue($this->p2pBot2->editPage($this->pageName, $addContent2), 'failed to edit page ' . $this->pageName);
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     $addContent3 = "L'ours polaire est principalement carnivore\net le panda géant se nourrit presque exclusivement de bambou,\nles six autres espèces sont omnivores, leur alimentation variée\ncomprend essentiellement des plantes et des animaux.";
     $this->assertTrue($this->p2pBot3->editPage($this->pageName, $addContent3), 'failed to edit page ' . $this->pageName);
     // create push on wiki3
     $this->assertTrue($this->p2pBot3->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot3->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot3->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot3->bot->results . ')');
     // create pull on wiki1 from wiki2
     $this->assertTrue($this->p2pBot1->createPull($this->pullName . '2', $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed . '2'), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // create pull on wiki1 from wiki3
     $this->assertTrue($this->p2pBot1->createPull($this->pullName . '3', $this->wiki3, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed . '3'), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $this->assertEquals(count($PatchonWiki1), 3);
 }
 /**
  * Create one page with tow attachment, push it
  * pull it on wiki2
  * modify the attachment on wiki2 , push it
  * pull it on wiki1
  * the tow wiki must have the same page and attachment
  */
 public function testSimple1()
 {
     // create page
     $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')');
     // assert page Ours exist on wiki1
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName);
     // upload the file on wiki1
     $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file11, $this->file, '0'));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size1));
     // edit File:Ours.jpg on wiki1
     $this->assertTrue($this->p2pBot1->editPage($this->filePage, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )');
     // upload the second file on wiki1
     $this->assertTrue($this->p2pBot1->uploadFile($this->fileDir . $this->file21, $this->file2, '0'));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size3));
     // edit File:Ours.pdf on wiki1
     $this->assertTrue($this->p2pBot1->editPage($this->filePage2, $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )');
     // create push on wiki1
     $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // change file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file12, $this->file, '1'));
     // test if the good file was upload on wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2));
     // change second file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file22, $this->file2, '1'));
     // test if the good file was upload on wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file2, $this->file_size4));
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2));
     // test if the good file was upload on wiki1
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file2, $this->file_size4));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage2 . ']]', '-3FpatchID');
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2));
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage);
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage2);
 }
 /**
  * Create one page with tow attachment, push it
  * pull it on wiki2
  */
 public function testSimple1()
 {
     // create page
     $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')');
     // assert page Ours exist on wiki1
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName);
     system("cp Import/Ours1.jpg cache/Ours1.jpg");
     $file_size = filesize("cache/Ours1.jpg");
     for ($i = 1; $i <= $this->nb; $i++) {
         $file = "cache/Ours" . $i . ".jpg";
         // upload the file on wiki1
         $this->assertTrue($this->p2pBot1->uploadFile($file, $this->file . $i . ".jpg", '0'));
         // test if the good file was upload on wiki1
         $this->assertTrue($this->p2pBot1->getFileFeatures($this->file . $i . ".jpg", $file_size));
         // edit File:Ours.jpg on wiki1
         $this->assertTrue($this->p2pBot1->editPage($this->filePage . $i . ".jpg", $this->pushRequest), 'failed to edit page ' . $this->filePage . ' ( ' . $this->p2pBot1->bot->results . ' )');
         // remove file
         system("mv cache/Ours" . $i . ".jpg cache/Ours" . ($i + 1) . ".jpg");
     }
     system("rm cache/Ours*");
     // create push on wiki1
     $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals(count($PatchonWiki1), count($PatchonWiki2));
 }
    public function test1()
    {
        // pages creation
        // Form:author
        $pageName = 'Form:Author';
        $formauthor = '<noinclude>
This is the &quot;Author&quot; form.
To add a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.


{{#forminput:Author}}

</noinclude><includeonly>
<div id=&quot;wikiPreview&quot; style=&quot;display: none; border-bottom: 1px solid #AAAAAA;&quot;></div>
{{{for template|Author}}}
{| class=&quot;formtable&quot;
! Country:
| {{{field|Country}}}
|}
{{{end template}}}

\'\'\'Free text:\'\'\'

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName, $formauthor), 'Failed to create page ' . $pageName . ' (' . $this->p2pBot1->bot->results . ')');
        // Form:book
        $pageName1 = 'Form:Book';
        $formbook = '<noinclude>
This is the &quot;Book&quot; form.
To add a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.


{{#forminput:Book}}

</noinclude><includeonly>
<div id=&quot;wikiPreview&quot; style=&quot;display: none; border-bottom: 1px solid #AAAAAA;&quot;></div>
{{{for template|Book}}}
{| class=&quot;formtable&quot;
! Authors:
| {{{field|Authors}}}
|-
! Genres:
| {{{field|Genres}}}
|-
! Year:
| {{{field|Year}}}
|-
! Number of pages:
| {{{field|Number of pages}}}
|}
{{{end template}}}

\'\'\'Free text:\'\'\'

{{{standard input|free text|rows=10}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName1, $formbook), 'Failed to create page ' . $pageName1 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Has genre
        $pageName2 = 'Property:Has_genre';
        $hasgenre = 'This is a property of type [[Has type::String]].

The allowed values for this property are:
* [[Allows value::Art]]
* [[Allows value::Cookbook]]
* [[Allows value::Fiction]]
* [[Allows value::History]]
* [[Allows value::Poetry]]
* [[Allows value::Science]]
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName2, $hasgenre), 'Failed to create page ' . $pageName2 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Has number of pages
        $pageName3 = 'Property:Has_number_of_pages';
        $nbpages = 'This is a property of type [[Has type::Number]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName3, $nbpages), 'Failed to create page ' . $pageName3 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Is from country
        $pageName4 = 'Property:Is_from_country';
        $isfromcountry = 'This is a property of type [[Has type::String]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName4, $isfromcountry), 'Failed to create page ' . $pageName4 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Was published in year
        $pageName5 = 'Property:Was_published_in_year';
        $pubyear = 'This is a property of type [[Has type::Number]].
[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPage($pageName5, $pubyear), 'Failed to create page ' . $pageName5 . ' (' . $this->p2pBot1->bot->results . ')');
        // Property:Was written by
        $pageName6 = 'Property:Was_written_by';
        $written = 'This is a property of type [[Has type::Page]].
[[Category:package]]
This property uses the form [[Has default form::Form:Author]].';
        $this->assertTrue($this->p2pBot1->createPage($pageName6, $written), 'Failed to create page ' . $pageName6 . ' (' . $this->p2pBot1->bot->results . ')');
        // Template:Book
        //        $pageName7 = 'Template:Book';
        //        $tampBook = '<noinclude>
        // This is the &quot;Book&quot; template.
        // It should be called in the following format:
        // <pre>
        // {{Book
        // |Authors=
        // |Genres=
        // |Year=
        // |Number of pages=
        // }}
        // </pre>
        // Edit the page to see the template text.
        // </noinclude><includeonly>
        // {| class=&quot;wikitable&quot;
        // ! Author(s)
        // | {{#arraymap:{{{Authors|}}}|,|x|[[Was written by::x]]}}
        // |-
        // ! Genre(s)
        // | {{#arraymap:{{{Genres|}}}|,|x|[[Has genre::x]]}}
        // |-
        // ! Year of publication
        // | [[Was published in year::{{{Year|}}}]]
        // |-
        // ! Number of pages
        // | [[Has number of pages::{{{Number of pages|}}}]]
        // |}
        //
        // [[Category:Books]]
        // </includeonly>
        // [[Category:package]]
        // ';
        //        $this->assertTrue($this->p2pBot1->createPage($pageName7,$tampBook),
        //            'Failed to create page '.$pageName7.' ('.$this->p2pBot1->bot->results.')');
        //
        //        //Template:Author
        //        $pageName8 = 'Template:Author';
        //        $tampAuthor = '<noinclude>
        // This is the &quot;Author&quot; template.
        // It should be called in the following format:
        // <pre>
        // {{Author
        // |Country=
        // }}
        // </pre>
        // Edit the page to see the template text.
        // </noinclude><includeonly>
        // {| class=&quot;wikitable&quot;
        // ! Country of origin
        // | [[Is from country::{{{Country|}}}]]
        // |-
        // ! Books by this author
        // | {{#ask:[[Was written by::{{SUBJECTPAGENAME}}]]|format=list}}
        // |}
        //
        // [[Category:Authors]]
        // </includeonly>
        // [[Category:package]]';
        //
        // $this->assertTrue($this->p2pBot1->createPage($pageName8,$tampAuthor),
        //            'Failed to create page '.$pageName8.' ('.$this->p2pBot1->bot->results.')');
        // create push on wiki1
        $pushName = 'PushPackage';
        $pushRequest = '[[Category:package]]';
        $this->assertTrue($this->p2pBot1->createPush($pushName, $pushRequest), 'Failed to create push : ' . $pushName . ' (' . $this->p2pBot1->bot->results . ')');
        // push on wiki1
        $this->assertTrue($this->p2pBot1->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot2->bot->results . ')');
        // create pull on wiki2
        $pullName = 'PullPackage';
        $this->assertTrue($this->p2pBot2->createPull($pullName, $this->wiki1, $pushName), 'failed to create pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')');
        // pull
        $this->assertTrue($this->p2pBot2->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')');
        // assert pages exist
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName1);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName2);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName3);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName4);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName5);
        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName6);
        //        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName7);
        //        assertPageExist($this->p2pBot2->bot->wikiServer, $pageName8);
        // assert that there is the same changeSet on the 2 wikis
        $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
        $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID');
        $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
        // assert that there is the same patch on the 2 wikis
        $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
        $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID');
        $PatchonWiki1 = arraytolower($PatchonWiki1);
        $PatchonWiki2 = arraytolower($PatchonWiki2);
        $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
        // assert that wiki1/page == wiki2/page
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName1);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName2);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName3);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName4);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName5);
        assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageName6);
    }
Exemple #7
0
 public function testSimple2()
 {
     $text = "DSMW implements the Logoot algorithm (see [[Presentation_and_Papers|Papers and presentations]]).\nThis algorithm allows automatic resolution of edition conflicts.\n\nWhat we call \"conflict\" is when there is a concurrent editing on an article i.e. the same article has been modified by many users. For instance, this is the case when a user  edits her local copy of a page and pulls remote modifications on this page.\n\n==Summary==\n\n\nIn the following table, we summarize the different cases of concurrent editing and the result produced by the merge algorithm.\nThe first column presents the content of the  '''initial state''' of the page.\n'''DSMW server1''' and '''DSMW server2''' represent two concurrent modifications on the same initial state.\n'''Results''' is the convergent state i.e. the state that will reached on all servers after complete propagation of concurrent changes...\n\n\n{|  border='1' cellpadding='5' cellspacing='0'\n|   valign='top' |  Scenario\n|   valign='top' |  Initial state\n|   valign='top' |  DSMW server1\n|   valign='top' |  DSMW server2\n|   valign='top' |  Results\n|   valign='top' |  Comments\n<div class='vspace'></div>\n|-\n|   valign='top' |   Insert/Insert at different lines\n|   valign='top' |  initial_line\n|   valign='top' | <span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line </span>\n|   valign='top' | <span  style='color: black;'>initial_line <br clear='all' /></span><span  style='color: green;'>inserted_line2 </span>\n|   valign='top' | <span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line <br clear='all' /></span><span  style='color: green;'>inserted_line2 </span>\n|   valign='top' | <ul><li>DSMW server1 inserts a line before the initial line and DSMW server2 inserts a line after the initial line\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  Ins/ins the same line\n|   valign='top' |  initial_line1 <br clear='all' /> initial_line2\n|   valign='top' |  initial_line1 <br clear='all' /><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span>\n|   valign='top' |  initial_line1 <br clear='all' /><span  style='color: green;'>inserted_line2 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span>\n|   valign='top' | <ul><li>initial_line1 <br clear='all' /><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: green;'>inserted_line2 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span></li></ul><p>or\n</p><ul><li>initial_line1 <br clear='all' /><span  style='color: green;'>inserted_line2  <br clear='all' /></span><span  style='color: red;'>inserted_line1 <br clear='all' /></span><span  style='color: black;'>initial_line2 </span></li></ul>\n|   valign='top' | <ul><li>DSMW server1 and 2 insert a different line between the initial lines\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' | update/update the same line\n|   valign='top' |  XXX\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' |  XX<span  style='color: green;'>Z </span>\n|   valign='top' | <ul><li>XX<span  style='color: red;'>Y <br clear='all' /></span><span  style='color: black;'>XX</span><span  style='color: green;'>Z </span></li></ul><p>or\n</p><ul><li><span  style='color: black;'>XX</span><span  style='color: green;'>Z <br clear='all' /></span><span  style='color: black;'>XX</span><span  style='color: red;'>Y </span></li></ul>\n|   valign='top' | <ul><li>DSMW server1 and 2 update the initial line with a different letter\n</li><li>There is no update operation in DSMW, update is equivalent to delete old line and insert a new one with the new content\n</li><li>The *or* does not means that we can have one value in one site and another in another site. Logoot will decide the convergent state by choosing one solution\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  update/delete same line\n|   valign='top' |  XXX\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' |  XX<span  style='color: red;'>Y </span>\n|   valign='top' | <ul><li>DSMW server1 updates the initial line and DSMW server2 deletes the initial line\n</li></ul><div class='vspace'></div>\n|-\n|   valign='top' |  Del/Del the same line\n|   valign='top' |  initial_line\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <span  style='color: red;'><em><del>line deleted</del></em></span>\n|   valign='top' | <ul><li>DSMW server1 and server2 delete the &ldquo;initial_line&rdquo;\n</li></ul>\n|}\n\n[[Category:DSMWDocumentation]]\n";
     $text1 = "* DSMW2 will subscribe to the DSMW1 push feed. Go to the and tp '''DSMW Admin functions'''  on the '''special pages''' and click on '''[ADD]''' beside   PULL. This leads to the following form:\n\n\n[[Image:2-1addpull1.png]]\n\n\n* Complete this form with the Server URL, the PushFeed name (informations received from DSMW1 user) and the PullFeed name. In this tutorial, the server URL is: \"http://localhost/wiki1\", the PushFeed Name is: \"PushTutorial\" and the  PullFeedName is \"PullTutorial\" as showing below:\n\nNote that the PullFeed name is free, we use this one only for the example.\n\n\n[[Image:2-2addpull1.png]]\n----\n'''''Since DSMW-0.6, this page has been modified and has the layout represented by the image below'''''\n\n[[Image:pullpagecreation.png]]\n----\n\n\n'''Important:''' the PushFeed name is case sensitive, if you do not respect that  (and you will not get the expected informations).\n\n* Click on the '''ADD''' button to create  the PullFeed \"PullTutorial\".\n\n\n[[Image:pulltutorial2.png]]\n\n\nNote that we could \"pull\" the informations directly in this page, but we will use Administration page, so follow the link '''Special:ArticleAdminPage''' under the \"PULL\" button.\n\nRemark: We pull from the DSMW Administration page because we wanted to show you that you can see more informations on this page (and that you could pull more than one pullFeed, if they were more than one...).\n\n\n[[Image:2-4adminpage.png]]\n\n\nIf you want to see how many patches are available on remote server  click on \"'''[Display]'''\" and the pullfeed table will appear like this:\n\n\n[[Image:2-4-1adminpage.png]]\n\n\n* Select the PullFeed you have just created by check the checkbox and click on the '''PULL''' button. A ChangeSet page that  recapitulates the \"pulled\" informations (including the identifier of patches) is created.\n\n\n[[Image:changeset2.png]]\n\n\n* Now the \"pull\" procedure is completed on DSMW2, you should have the 2 articles \"Hello\" and \"World\" on DSMW2. Let's check it...\n\nWrite \"Hello\" in the search box and click on the button \"go\".\n\n\n[[Image:2-6hellopage.png]]\n\n\n...and...\n\n\n[[Image:2-8worldpage.png]]\n\n\n* Let us take a look to the Administration tab informations:\n\n\n[[Image:DSMWonHello2b.png]]\n\n\n...and...\n\n\n[[Image:DSMWonWorld2.png]]\n\n\n'''Remark: '''we have  the right informations, a  grey tinted patch means that a remote patch has been locally integrated.\n\nWe have the right informations because we made one modifications on Hello that are 2 insertions and one modification with 4 inserts.\n\n* Let us take a look to the \"DSMW Admin functions\" page informations:\n\n\n[[Image:2-10adminpage.png]]\n\n\nThe informations are updated!  You can  display remote patches:\n\n\n[[Image:2-10-1adminpage.png]]\n\n\n''Congratulations, you finished the first execution scenario with DSMW. Now you can enjoy playing with DSMW. If you want to learn more about the using of DSMW see the different [[DSMW User Manual|documentations]]''.\n\n[[Category:DSMWDocumentation]]\n";
     $this->assertTrue($this->p2pBot1->createPage('Conflict_Management1', $text));
     $this->p2pBot1->createPage('Subscription_Procedure1', $text1);
     $this->p2pBot1->createPush('PushDSMWDoc1', '[[Category:DSMWDocumentation]]');
     $this->p2pBot1->push('PushFeed:PushDSMWDoc1');
     $this->p2pBot2->createPull('PullDSMWDoc1', $this->p2pBot1->bot->wikiServer, 'PushDSMWDoc1');
     $this->p2pBot2->pull('PullFeed:PullDSMWDoc1');
     //assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::PushFeed:PushDSMWDoc1]]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::PullFeed:PullDSMWDoc1]]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     //assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Conflict_Management1]]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     $PatchonWiki3 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID');
     $PatchonWiki4 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::Subscription_Procedure1]]', '-3FpatchID');
     $PatchonWiki3 = arraytolower($PatchonWiki3);
     $PatchonWiki4 = arraytolower($PatchonWiki4);
     $this->assertEquals($PatchonWiki3, $PatchonWiki4, 'patch are not equals on the 2 wikis');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Conflict_Management1');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, 'Subscription_Procedure1');
 }
 /**
  * execute criss cross merge
 
 W1|W2
 1  2 - make change in 2 wiki
 |\/|
 |/\|
 3==4
 */
 public function testSimple3()
 {
     // create page
     $this->assertTrue($this->p2pBot1->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot1->bot->results . ')');
     // assert page Ours exist on wiki1
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->pageName);
     // create push on wiki1
     $this->assertTrue($this->p2pBot1->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot1->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create page
     $this->assertTrue($this->p2pBot2->createPage($this->pageName, $this->content), 'Failed to create page ' . $this->pageName . ' (' . $this->p2pBot2->bot->results . ')');
     // assert page Ours exist on wiki2
     assertPageExist($this->p2pBot2->bot->wikiServer, $this->pageName);
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot2->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki2
     $this->assertTrue($this->p2pBot2->createPull($this->pullName, $this->wiki1, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot2->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot2->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     // assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->pageName . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->pageName);
 }
Exemple #9
0
 function testSimple4()
 {
     $this->testSimple2();
     $countCSonWiki1 = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     $countCSonWiki2 = count(getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     $pushName = 'PushCity10';
     $pullName = 'pullCity';
     $this->assertTrue($this->p2pBot1->push('PushFeed:' . $pushName), 'failed to push ' . $pushName . ' (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot2->Pull('PullFeed:' . $pullName), 'failed to pull ' . $pullName . ' (' . $this->p2pBot2->bot->results . ')');
     $countCS = count(getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     //assert no patch created
     $this->assertTrue($countCSonWiki2 == $countCS);
     // assert that wiki1/Category:Lambach == wiki2/Category:Lambach
     $contentWiki1 = getContentPage($this->p2pBot1->bot->wikiServer, 'Category:Lambach');
     $contentWiki2 = getContentPage($this->p2pBot2->bot->wikiServer, 'Category:Lambach');
     assertPageExist($this->p2pBot2->bot->wikiServer, 'Category:Lambach');
     $this->assertEquals($contentWiki1, $contentWiki2, 'Failed content page Lambach');
     //assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'));
     $CSonWiki2 = count(getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]]', '-3FchangeSetID'));
     $this->assertEquals($CSonWiki1, $CSonWiki2);
     //assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     $PatchonWiki2 = count(getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]]', '-3FpatchID'));
     $this->assertEquals($PatchonWiki1, $PatchonWiki2);
 }
 /**
  * Create one page with an attachment, push it
  * pull it on wiki2
  * wiki2 change the file, pull the page
  * wiki1 push the page and must have the new attachment on local
  */
 public function testSimple4()
 {
     $this->testSimple3();
     // change file on wiki2
     $this->assertTrue($this->p2pBot2->uploadFile($this->fileDir . $this->file2, $this->file, '1'));
     $PatchonWiki1 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $this->assertEquals(count($PatchonWiki1), 3);
     // test si le fichier a été uploder sur le wiki2
     $this->assertTrue($this->p2pBot2->getFileFeatures($this->file, $this->file_size2));
     // create push on wiki2
     $this->assertTrue($this->p2pBot2->createPush($this->pushName, $this->pushRequest), 'Failed to create push : ' . $this->pushName . ' (' . $this->p2pBot1->bot->results . ')');
     // push
     $this->assertTrue($this->p2pBot2->push($this->pushFeed), 'failed to push ' . $this->pushFeed . ' (' . $this->p2pBot2->bot->results . ')');
     // create pull on wiki1 from wiki2
     $this->assertTrue($this->p2pBot1->createPull($this->pullName, $this->wiki2, $this->pushName), 'failed to create pull ' . $this->pullName . ' (' . $this->p2pBot1->bot->results . ')');
     // pull
     $this->assertTrue($this->p2pBot1->Pull($this->pullFeed), 'failed to pull ' . $this->pullFeed . ' (' . $this->p2pBot1->bot->results . ')');
     // test if the good file was upload on wiki1 from wiki2
     $this->assertTrue($this->p2pBot1->getFileFeatures($this->file, $this->file_size2));
     assertPageExist($this->p2pBot1->bot->wikiServer, $this->filePage);
     // assert that there is the same changeSet on the 2 wikis
     $CSonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[ChangeSet:+]][[inPullFeed::' . $this->pullFeed . ']]', '-3FchangeSetID');
     $CSonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[ChangeSet:+]][[inPushFeed::' . $this->pushFeed . ']]', '-3FchangeSetID');
     $this->assertEquals($CSonWiki1, $CSonWiki2, 'changeSet are not equals on the 2 wikis');
     // assert that there is the same patch on the 2 wikis
     $PatchonWiki1 = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki2 = getSemanticRequest($this->p2pBot2->bot->wikiServer, '[[Patch:+]][[onPage::' . $this->filePage . ']]', '-3FpatchID');
     $PatchonWiki1 = arraytolower($PatchonWiki1);
     $PatchonWiki2 = arraytolower($PatchonWiki2);
     $this->assertEquals($PatchonWiki1, $PatchonWiki2, 'patch are not equals on the 2 wikis');
     // assert that wiki1/File:Ours == wiki2/File:Ours
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $this->filePage);
 }
Exemple #11
0
 /**
  *
  */
 public function testPatchPushed2()
 {
     $this->testPatchPushed1();
     $pageName = 'Pouxeux';
     $pushName = 'PushFeed:PushCity11';
     $this->assertTrue($this->p2pBot1->createPage($pageName, 'Pouxeux [[Category:city]]'));
     $this->assertTrue($this->p2pBot1->push($pushName));
     $published = $this->getListPatchPushed('PushFeed:PushCity11', $pageName);
     $this->assertTrue(count($published) == 1);
     $onPage = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[patchID::' . $published[0] . ']]', '-3FonPage');
     $this->assertEquals($pageName, $onPage[0], 'failed into apiPatchPush, the patch found must be on page ' . $pageName . ' but is on ' . $onPage[0]);
     $this->p2pBot1->editPage($pageName, '....');
     $published = $this->getListPatchPushed($pushName, $pageName);
     $this->assertTrue(count($published) == 1);
     $onPage = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[patchID::' . $published[0] . ']]', '-3FonPage');
     $this->assertEquals($pageName, $onPage[0], 'failed into apiPatchPush, the patch found must be on page ' . $pageName . ' but is on ' . $onPage[0]);
     $this->assertTrue($this->p2pBot1->push('PushFeed:PushCity11'));
     $published = $this->getListPatchPushed($pushName, $pageName);
     $this->assertTrue(count($published) == 2);
     $onPage = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[patchID::' . $published[0] . ']]', '-3FonPage');
     $this->assertEquals($pageName, $onPage[0], 'failed into apiPatchPush, the patch found must be on page ' . $pageName . ' but is on ' . $onPage[0]);
     $onPage = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[patchID::' . $published[1] . ']]', '-3FonPage');
     $this->assertEquals($pageName, $onPage[0], 'failed into apiPatchPush, the patch found must be on page ' . $pageName . ' but is on ' . $onPage[1]);
 }
 public function testMultiPush()
 {
     $this->assertTrue($this->p2pBot1->createPage('Toto12', '[[Category:toto]]'));
     $this->assertTrue($this->p2pBot1->createPage('Titi12', '[[Category:titi]]'));
     $this->assertTrue($this->p2pBot1->createPage('Tata12', '[[Category:tata]]'));
     $this->assertTrue($this->p2pBot1->createPush('PushToto12', '[[Category:toto]]'));
     $this->assertTrue($this->p2pBot1->createPush('PushTiti12', '[[Category:titi]]'));
     $this->assertTrue($this->p2pBot1->createPush('PushTata12', '[[Category:tata]]'));
     $array = array('PushFeed:PushToto12', 'PushFeed:PushTiti12', 'PushFeed:PushTata12');
     $this->assertTrue($this->p2pBot1->push($array));
     // assert that allchange set were created
     $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[inPushFeed::PushFeed:PushToto12]]', '-3FchangeSetID'));
     $this->assertTrue($countCS == 1);
     $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[inPushFeed::PushFeed:PushTiti12]]', '-3FchangeSetID'));
     $this->assertTrue($countCS == 1);
     $countCS = count(getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[inPushFeed::PushFeed:PushTata12]]', '-3FchangeSetID'));
     $this->assertTrue($countCS == 1);
 }
 function testOperationToLogootOp()
 {
     $pageName = 'Toto';
     $content = 'toto tata titi';
     $this->assertTrue($this->p2pBot1->createPage($pageName, $content), 'failed to create page ' . $pageName . ' (' . $this->p2pBot1->bot->results . ')');
     $patchId = getSemanticRequest($this->p2pBot1->bot->wikiServer, '[[Patch:+]][[onPage::Toto]]', '');
     $patchId = $patchId[0];
     $dom = getPatchXML($this->p2pBot1->bot->wikiServer, $patchId);
     $op = $dom->getElementsByTagName('operation');
     foreach ($op as $o) {
         $operations[] = $o->firstChild->nodeValue;
     }
     $this->assertTrue(count($operations) == 1);
     $op = operationToLogootOp($operations[0]);
     $this->assertTrue($op instanceof LogootIns, 'failed to create logootIns operation');
     $this->assertEquals($content, $op->getLineContent());
     // logoutIntegrate
 }