(bug 23375) Added ogv, oga, spx as extensions for ogg files. Patch by Derk-Jan Hartman.
[lhc/web/wiklou.git] / maintenance / tests / ApiSetup.php
1 <?php
2
3 abstract class ApiSetup extends PHPUnit_Framework_TestCase {
4 protected static $userName;
5 protected static $passWord;
6 protected static $user;
7 protected static $apiUrl;
8
9 function setup() {
10 global $wgServerName, $wgServer, $wgContLang, $wgAuth, $wgScriptPath,
11 $wgScriptExtension, $wgMemc, $wgRequest;
12
13 self::$apiUrl = $wgServer.$wgScriptPath."/api".$wgScriptExtension;
14
15 $wgMemc = new FakeMemCachedClient;
16 $wgContLang = Language::factory( 'en' );
17 $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
18 $wgRequest = new FauxRequest(array());
19 self::setupUser();
20 }
21
22 static function setupUser() {
23 if ( self::$user == NULL ) {
24 self::$userName = "Useruser";
25 self::$passWord = User::randomPassword();
26
27 self::$user = User::newFromName(self::$userName);
28 if ( !self::$user->getID() ) {
29 self::$user = User::createNew(self::$userName, array(
30 "email" => "test@example.com",
31 "real_name" => "Test User"));
32 }
33 self::$user->setPassword(self::$passWord);
34 self::$user->saveSettings();
35 }
36 }
37 }