Go to the documentation of this file.
11 protected function setUp() {
15 self::$apiUrl = $wgServer .
wfScript(
'api' );
23 'api_test_sysop@example.com',
29 'api_test_user@example.com',
36 'wgAuth' =>
new StubObject(
'wgAuth',
'AuthPlugin' ),
38 'wgUser' => self::$users[
'sysop']->
user,
78 if ( is_null( $session ) ) {
80 $session = $wgRequest->getSessionArray();
92 $context = $this->apiContext->newTestContext( $wgRequest,
$wgUser );
94 $module =
new ApiMain( $context,
true );
101 $module->getResultData(),
102 $context->getRequest(),
103 $context->getRequest()->getSessionArray()
106 if ( $appendModule ) {
107 $results[] = $module;
126 if ( $session ===
null ) {
127 $session = $wgRequest->getSessionArray();
130 if ( $session[
'wsToken'] ) {
132 $session[
'wsEditToken'] = $session[
'wsToken'];
138 throw new Exception(
"request data not in right format" );
143 if ( !array_key_exists(
$user, self::$users ) ) {
144 throw new MWException(
"Can not log in to undefined user $user" );
149 'lgname' => self::$users[
$user ]->username,
150 'lgpassword' => self::$users[
$user ]->password ) );
152 $token = $data[0][
'login'][
'token'];
158 'lgname' => self::$users[
$user ]->username,
159 'lgpassword' => self::$users[
$user ]->password,
169 'action' =>
'tokens',
170 'type' =>
'edit|delete|protect|move|block|unblock|watch'
171 ), $session,
false,
$user->user );
173 if ( !array_key_exists(
'tokens', $data[0] ) ) {
174 throw new MWException(
'Api failed to return a token list' );
177 return $data[0][
'tokens'];
181 $groups = PHPUnit_Util_Test::getGroups( get_class( $this ) );
182 $constraint = PHPUnit_Framework_Assert::logicalOr(
183 $this->contains(
'medium' ),
184 $this->contains(
'large' )
186 $this->assertThat( $groups, $constraint,
187 'ApiTestCase::setUp can be slow, tests must be "medium" or "large"'
This is the main API class, used for both external and internal processing.
WebRequest clone which takes values from a provided array.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getTokenList( $user, $session=null)
A BagOStuff object with no objects in it.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Wraps the user object, so we can also retain full access to properties like password if we log in via...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
presenting them properly to the user as errors is done by the caller $title
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
editPage( $pageName, $text, $summary='', $defaultNs=NS_MAIN)
Edits or creates a page/revision.
static getMain()
Static methods.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null)
Does the API request and returns the result.
ApiTestContext $apiContext
doApiRequestWithToken(array $params, array $session=null, User $user=null)
Add an edit token to the API request This is cheating a bit – we grab a token in the correct format a...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...