/**
  * @covers SpoofUser::record
  */
 public function testRecord()
 {
     $user = User::newFromName('SomeUsername');
     $user->addToDatabase();
     $s = new SpoofUser('SomeUsername');
     $this->assertTrue($s->record());
     // Check that it made it into the database
     $this->assertArrayEquals(array('SomeUsername'), $s->getConflicts());
 }
Ejemplo n.º 2
0
 /**
  * AntiSpoof: update records once a new account has been created.
  *
  * @see extensions/AntiSpoof
  */
 public function updateAntiSpoof()
 {
     $this->response->setFormat('json');
     $this->response->setCacheValidity(\WikiaResponse::CACHE_DISABLED);
     $this->response->setVal('success', false);
     if ($this->getVal('secret') != $this->wg->TheSchwartzSecretToken) {
         $this->response->setVal('message', 'invalid secret');
         return;
     }
     $username = $this->getVal('username');
     if (!empty($this->wg->EnableAntiSpoofExt)) {
         $spoofUser = new \SpoofUser($username);
         $this->response->setVal('success', $spoofUser->record());
         return;
     }
 }
 /**
  * On new account creation, record the username's thing-bob.
  * (Called after a user account is created)
  *
  * @param $user User
  * @return bool
  */
 public static function asAddNewAccountHook($user)
 {
     $spoof = new SpoofUser($user->getName());
     $spoof->record();
     return true;
 }