execute(); $data[0] = $module->getResultData(); $data[1] = $req; $data[2] = $_SESSION; return $data; } static function setupUser() { if ( self::$user == null || self::$sysopUser == null ) { self::$user = new UserWrapper( 'User for MediaWiki automated tests', User::randomPassword() ); self::$sysopUser = new UserWrapper( 'Sysop for MediaWiki automated tests', User::randomPassword(), 'sysop' ); } $GLOBALS['wgUser'] = self::$sysopUser->user; } } class UserWrapper { public $userName, $password, $user; public function __construct( $userName, $password, $group = '' ) { $this->userName = $userName; $this->password = $password; $this->user = User::newFromName( $this->userName ); if ( !$this->user->getID() ) { $this->user = User::createNew( $this->userName, array( "email" => "test@example.com", "real_name" => "Test User" ) ); } $this->user->setPassword( $this->password ); if ( $group !== '' ) { $this->user->addGroup( $group ); } $this->user->saveSettings(); } }