/** * Setup a fresh set of global users for each test. * Note: MediaWikiTestCase::resetDB() will delete all tables between * test runs, so no explicite tearDown() is needed. */ protected function setUp() { parent::setUp(); $u = new CentralAuthTestUser('GlobalUser', 'GUP@ssword', array('gu_id' => '1001'), array(array(self::safeWfWikiID(), 'primary'), array('enwiki', 'primary'), array('dewiki', 'login'), array('metawiki', 'password'))); $u->save($this->db); // Locked but not hidden Global account $u = new CentralAuthTestUser('GlobalLockedUser', 'GLUP@ssword', array('gu_id' => '1003', 'gu_locked' => 1, 'gu_hidden' => CentralAuthUser::HIDDEN_NONE, 'gu_email' => 'testlocked@localhost', 'gu_home_db' => 'metawiki'), array(array('metawiki', 'primary'), array(self::safeWfWikiID(), 'password'))); $u->save($this->db); // Global account that isn't attached on this wiki, and doesn't conflict $u = new CentralAuthTestUser('GlobalUnattachedUser', 'GUUP@ssword', array('gu_id' => '1004', 'gu_email' => 'testunattached@localhost', 'gu_home_db' => 'metawiki'), array(array('metawiki', 'primary')), false); $u->save($this->db); // Global unattached account with conflicting local user account $u = new CentralAuthTestUser('GlobalConflictUser', 'GCUP@ssword', array('gu_id' => '1005', 'gu_email' => 'testconflict@localhost', 'gu_home_db' => 'metawiki'), array(array('metawiki', 'primary'))); $u->save($this->db); $user = User::newFromName('GlobalConflictUser'); if ($user->idForName() == 0) { $user->addToDatabase(); $user->setPassword($this->password); $user->saveSettings(); } // Local only account $user = User::newFromName('AnotherNewUser'); if ($user->idForName() == 0) { $user->addToDatabase(); $user->setPassword('ANUP@ssword'); $user->saveSettings(); } // Global user who was renamed when migrated $u = new CentralAuthTestUser('GlobalUser~' . str_replace('_', '-', self::safeWfWikiID()), 'GURP@ssword', array('gu_id' => '1006'), array(array(self::safeWfWikiID(), 'primary'))); $u->save($this->db); }
/** * Setup a fresh set of global users for each test. * Note: MediaWikiTestCase::resetDB() will delete all tables between * test runs, so no explicite tearDown() is needed. */ protected function setUp() { parent::setUp(); $u = new CentralAuthTestUser('GlobalUser', 'GUP@ssword', array('gu_id' => '1001'), array(array(wfWikiID(), 'primary'), array('enwiki', 'primary'), array('dewiki', 'login'), array('metawiki', 'password'))); $u->save($this->db); $u = new CentralAuthTestUser('GlobalLockedUser', 'GLUP@ssword', array('gu_id' => '1003', 'gu_locked' => 1, 'gu_hidden' => CentralAuthUser::HIDDEN_NONE, 'gu_email' => 'testlocked@localhost', 'gu_home_db' => 'metawiki'), array(array('metawiki', 'primary'))); $u->save($this->db); }