/**
  * @depends testGetPageUsingTitle
  */
 public function testGetPageUsingId()
 {
     $factory = TestEnvironment::newDefault()->getFactory();
     $page = $factory->newPageGetter()->getFromPageId(self::$localPageIdentifier->getId());
     $this->assertEquals(self::$localPageIdentifier->getId(), $page->getPageIdentifier()->getId());
     $title = $page->getPageIdentifier()->getTitle();
     $this->assertEquals(self::$localPageIdentifier->getTitle(), $title);
 }
 /**
  * Set up some test categories and pages.
  */
 public function setUp()
 {
     $testEnvironment = TestEnvironment::newDefault();
     $factory = $testEnvironment->getFactory();
     // An empty category.
     $emptyCat = new PageIdentifier(new Title($this->emptyCatName));
     $factory->newRevisionSaver()->save(new Revision(new Content(''), $emptyCat));
     // A non-empty category.
     $testCat = new PageIdentifier(new Title($this->nonemptyCatName));
     $factory->newRevisionSaver()->save(new Revision(new Content(''), $testCat));
     // Some pages in the latter.
     // (Count must exceed the default categorymember result set size of 10.)
     $revisionSaver = $factory->newRevisionSaver();
     for ($i = 1; $i <= 35; $i++) {
         $testCat = new PageIdentifier(new Title("Test page {$i}"));
         // Even pages link to Main Page, odd pages transclude {{test}}.
         $mainPageLink = $i % 2 == 0 ? 'Go to [[Main Page]].' : 'This is a {{test}}.';
         $content = new Content("{$mainPageLink}\n\n[[{$this->nonemptyCatName}]]");
         $revisionSaver->save(new Revision($content, $testCat));
     }
     // Run all jobs, to make sure everything is up to date.
     $testEnvironment->runJobs();
     $this->pageListGetter = $factory->newPageListGetter();
 }
 public function setUp()
 {
     parent::setUp();
     $this->factory = TestEnvironment::newDefault()->getFactory();
     $this->traverser = $this->factory->newCategoryTraverser();
 }
 public function testCreateUser()
 {
     $factory = TestEnvironment::newDefault()->getFactory();
     $createResult = $factory->newUserCreator()->create(self::$localApiUser->getUsername(), self::$localApiUser->getPassword());
     $this->assertTrue($createResult);
 }