/**
  * @dataProvider provideValidConstruction
  */
 public function testValidConstruction($title, $ns)
 {
     $titleObj = new Title($title, $ns);
     $this->assertEquals($title, $titleObj->getText());
     $this->assertEquals($title, $titleObj->getTitle());
     $this->assertEquals($ns, $titleObj->getNs());
 }
Exemple #2
0
 /**
  * @param int $pageid
  * @param Title $target
  * @param array $extraParams
  *
  * @return array
  */
 private function getMoveParams($pageid, $target, $extraParams)
 {
     $params = [];
     $params['fromid'] = $pageid;
     $params['to'] = $target->getTitle();
     $params['token'] = $this->api->getToken('move');
     return array_merge($extraParams, $params);
 }
 /**
  * @param Title $title
  *
  * @throws OutOfBoundsException
  * @returns string
  */
 private function getUndeleteToken(Title $title)
 {
     $response = $this->api->postRequest(new SimpleRequest('query', ['list' => 'deletedrevs', 'titles' => $title->getTitle(), 'drprop' => 'token']));
     if (array_key_exists('token', $response['query']['deletedrevs'][0])) {
         return $response['query']['deletedrevs'][0]['token'];
     } else {
         throw new OutOfBoundsException('Could not get page undelete token from list=deletedrevs query');
     }
 }
 /**
  * @param int $pageid
  * @param Title $target
  * @param MoveOptions|null $options
  *
  * @return array
  */
 private function getMoveParams($pageid, $target, $options)
 {
     $params = array();
     $params['fromid'] = $pageid;
     $params['to'] = $target->getTitle();
     $reason = $options->getReason();
     if (!empty($reason)) {
         $params['reason'] = $reason;
     }
     $params['token'] = $this->api->getToken('move');
     return $params;
 }