MediaWiki  REL1_22
ApiTestCase Class Reference
Inheritance diagram for ApiTestCase:
Collaboration diagram for ApiTestCase:

List of all members.

Public Member Functions

 testApiTestGroup ()

Protected Member Functions

 doApiRequest (array $params, array $session=null, $appendModule=false, User $user=null)
 Does the API request and returns the result.
 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 and then add it to the pseudo-session and to the request, without actually requesting a "real" edit token.
 doLogin ($user= 'sysop')
 editPage ($pageName, $text, $summary= '', $defaultNs=NS_MAIN)
 Edits or creates a page/revision.
 getTokenList ($user, $session=null)
 setUp ()
 setUp and tearDown should (where significant) happen in reverse order.

Protected Attributes

ApiTestContext $apiContext

Static Protected Attributes

static $apiUrl

Detailed Description

Definition at line 3 of file ApiTestCase.php.


Member Function Documentation

ApiTestCase::doApiRequest ( array params,
array session = null,
appendModule = false,
User user = null 
) [protected]
ApiTestCase::doApiRequestWithToken ( array params,
array session = null,
User user = null 
) [protected]

Add an edit token to the API request This is cheating a bit -- we grab a token in the correct format and then add it to the pseudo-session and to the request, without actually requesting a "real" edit token.

Parameters:
$paramsArray: key-value API params
$sessionArray|null: session array
$userUser|null A User object for the context
Returns:
result of the API call
Exceptions:
Exceptionin case wsToken is not set in the session

Definition at line 122 of file ApiTestCase.php.

Referenced by ApiEditPageTest\testEdit(), ApiEditPageTest\testEditAppend(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_redirect(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), ApiEditPageTest\testNonTextEdit(), ApiUploadTest\testUpload(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadMissingParams(), ApiUploadTest\testUploadSameContent(), ApiUploadTest\testUploadSameFileName(), ApiUploadTest\testUploadStash(), and ApiUploadTest\testUploadZeroLength().

ApiTestCase::editPage ( pageName,
text,
summary = '',
defaultNs = NS_MAIN 
) [protected]

Edits or creates a page/revision.

Parameters:
$pageNamestring page title
$textstring content of the page
$summarystring optional summary string for the revision
$defaultNsint optional namespace id
Returns:
array as returned by WikiPage::doEditContent()

Definition at line 51 of file ApiTestCase.php.

Referenced by ApiQueryContinue2Test\addDBData(), ApiQueryContinueTest\addDBData(), ApiQueryBasicTest\addDBData(), and ApiQueryBasicTest\testGeneratorRedirects().

ApiTestCase::getTokenList ( user,
session = null 
) [protected]

Definition at line 166 of file ApiTestCase.php.

References $user, array(), and doApiRequest().

Referenced by ApiBlockTest\getTokens(), ApiWatchTest\getTokens(), and ApiTest\runTokenTest().

ApiTestCase::setUp ( ) [protected]

setUp and tearDown should (where significant) happen in reverse order.

Reimplemented from MediaWikiLangTestCase.

Reimplemented in ApiEditPageTest, ApiTestCaseUpload, ApiParseTest, ApiPurgeTest, ApiWatchTest, ApiQueryTest, ApiCreateAccountTest, ApiBlockTest, and UploadFromUrlTest.

Definition at line 10 of file ApiTestCase.php.

References array(), global, ApiQueryInfo\resetTokenCache(), MediaWikiTestCase\setMwGlobals(), user, and wfScript().

Definition at line 179 of file ApiTestCase.php.


Member Data Documentation

ApiTestContext ApiTestCase::$apiContext [protected]

Definition at line 8 of file ApiTestCase.php.

ApiTestCase::$apiUrl [static, protected]

Definition at line 4 of file ApiTestCase.php.


The documentation for this class was generated from the following file: