コード例 #1
0
    public function testAppendPage()
    {
        $pageName = "Lambach";
        $content = 'content page Lambach
[[Category:city1]]';
        $this->p2pBot1->createPage($pageName, $content);
        assertPageExist($this->p2pBot1->bot->wikiServer, $pageName);
        $contentFound = getContentPage($this->p2pBot1->bot->wikiServer, $pageName);
        $this->assertEquals($content, $contentFound);
        $this->p2pBot1->editPage($pageName, "toto");
        $content .= '
toto';
        $contentFound = getContentPage($this->p2pBot1->bot->wikiServer, $pageName);
        $this->assertEquals($content, $contentFound);
    }
コード例 #2
0
ファイル: p2pTest4.php プロジェクト: hala54/DSMW
 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);
 }
コード例 #3
0
ファイル: p2pAssert.php プロジェクト: hala54/DSMW
function assertContentEquals($server1, $server2, $pageName)
{
    $contentPage1 = getContentPage($server1, $pageName);
    $contentPage2 = getContentPage($server2, $pageName);
    PHPUnit_Framework_Assert::assertEquals($contentPage1, $contentPage2, 'content page ' . $pageName . ' is not equals between ' . $server1 . ' and ' . $server2 . view($contentPage1, "page {$server1} {$pageName}") . view($contentPage2, "page {$server2} {$pageName}"));
}
コード例 #4
0
 public function testSimple()
 {
     // wiki1 = prof1
     // wiki2 = prof2
     // wiki3 = student
     // create page on wiki1
     $pageNameLesson1 = 'Lesson1';
     $this->assertTrue($this->p2pBot1->createPage($pageNameLesson1, 'Intro.... [[type::Lesson]][[forYear::2009]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $contentWiki1 = "test wiki1";
     echo sleep(10);
     $this->p2pBot1->editPage($pageNameLesson1, $contentWiki1);
     $this->assertTrue($this->p2pBot1->createPage('Exercises1', 'content exercises1 [[forYear::2009]] [[type::Exercise]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->createPage('Exam1', 'content exam1 [[forYear::2009]] [[type::Exam]]'), 'Failed to create page Exercises1 (' . $this->p2pBot1->bot->results . ')');
     $pageContentLesson1 = getContentPage($this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     // push on wiki1 for prof2, only the lesson
     $this->assertTrue($this->p2pBot1->createPush('Course1', '[[type::Lesson]][[forYear::2009]]'), 'Failed to create push : Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->push('PushFeed:Course1'), 'failed to push ' . 'Course1' . ' (' . $this->p2pBot1->bot->results . ')');
     // pull on wiki2 from prof1 push
     $this->assertTrue($this->p2pBot2->createPull('Prof1Course1', $this->p2pBot1->bot->wikiServer, 'Course1'), 'failed to create pull Prof1Course1 (' . $this->p2pBot2->bot->results . ')');
     // sleep(10);
     $this->assertTrue($this->p2pBot2->Pull('PullFeed:Prof1Course1'), 'failed to pull Prof1Course1 (' . $this->p2pBot2->bot->results . ')');
     assertPageExist($this->p2pBot2->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot2->bot->wikiServer, $this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     // edit page lesson1 on wiki2
     $addContent1 = 'edition on wiki2';
     $this->p2pBot2->editPage($pageNameLesson1, $addContent1);
     $pageContentLesson1 = getContentPage($this->p2pBot2->bot->wikiServer, $pageNameLesson1);
     // push on wiki2 for prof1 only the lesson
     $this->assertTrue($this->p2pBot2->createPush('Course1', '[[type::Lesson]][[forYear::2009]]'), 'Failed to create push : Course1 (' . $this->p2pBot2->bot->results . ')');
     $this->assertTrue($this->p2pBot2->push('PushFeed:Course1'), 'failed to push S1Course1 (' . $this->p2pBot2->bot->results . ')');
     // pull on wiki1 from prof2 push
     $this->assertTrue($this->p2pBot1->createPull('Prof2Course1', $this->p2pBot2->bot->wikiServer, 'Course1'), 'failed to create pull Prof2Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->Pull('PullFeed:Prof2Course1'), 'failed to pull Prof2Course1 (' . $this->p2pBot1->bot->results . ')');
     assertPageExist($this->p2pBot1->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot2->bot->wikiServer, $pageNameLesson1);
     // push on wiki1 for student, lessons and exercises
     $this->assertTrue($this->p2pBot1->createPush('S1Course1', '[[type::!Exam]][[forYear::2009]]'), 'Failed to create push : S1Course1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->push('PushFeed:S1Course1'), 'failed to push S1Course1 (' . $this->p2pBot2->bot->results . ')');
     // pull on wiki3 from prof1
     $this->assertTrue($this->p2pBot3->createPull('Prof1Course1', $this->p2pBot1->bot->wikiServer, 'S1Course1'), 'failed to create pull Prof1Course1 (' . $this->p2pBot3->bot->results . ')');
     $this->assertTrue($this->p2pBot3->Pull('PullFeed:Prof1Course1'), 'failed to pull Prof2Course1 (' . $this->p2pBot3->bot->results . ')');
     assertPageExist($this->p2pBot3->bot->wikiServer, 'Lesson1');
     assertContentEquals($this->p2pBot3->bot->wikiServer, $this->p2pBot1->bot->wikiServer, $pageNameLesson1);
     assertPageExist($this->p2pBot3->bot->wikiServer, 'Exercises1');
     assertContentEquals($this->p2pBot3->bot->wikiServer, $this->p2pBot1->bot->wikiServer, 'Exercises1');
     // edit page lesson1 on wiki3
     // $this->p2pBot3->bot->wikiLogin();
     $addContent = 'content from student';
     $this->assertTrue($this->p2pBot3->editPage('Lesson1', $addContent), 'failed to edit page Lesson1');
     $pageContentLesson1 = getContentPage($this->p2pBot3->bot->wikiServer, $pageNameLesson1);
     // push on wiki3 for prof1, lessons and exercises
     $this->assertTrue($this->p2pBot3->createPush('StudCourse1', '[[type::!Exam]][[forYear::2009]]'), 'failed to create push : StudCourse1 (' . $this->p2pBot3->bot->results . ')');
     $this->assertTrue($this->p2pBot3->push('PushFeed:StudCourse1'), 'failed to push StudCourse1 (' . $this->p2pBot3->bot->results . ')');
     // pull on wiki1 from student
     $this->assertTrue($this->p2pBot1->createPull('StudCourse1', $this->p2pBot3->bot->wikiServer, 'StudCourse1'), 'failed to create pull StudCourse1 (' . $this->p2pBot1->bot->results . ')');
     $this->assertTrue($this->p2pBot1->Pull('PullFeed:StudCourse1'), 'failed to pull StudCourse1 (' . $this->p2pBot1->bot->results . ')');
     assertContentEquals($this->p2pBot1->bot->wikiServer, $this->p2pBot3->bot->wikiServer, $pageNameLesson1);
 }