MediaWiki  master
MWHttpRequestTestCase Class Reference
Inheritance diagram for MWHttpRequestTestCase:
Collaboration diagram for MWHttpRequestTestCase:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testBasicAuthentication ()
 
 testFactoryDefaults ()
 
 testgetFinalUrl ()
 
 testGetResponseHeaders ()
 
 testGetStatus ()
 
 testIsRedirect ()
 
 testRelativeRedirections ( $location, $final, $message=null)
 provideRelativeRedirects MWHttpRequest::getFinalUrl More...
 
 testSetCallback ()
 
 testSetCookie ()
 
 testSetCookieJar ()
 
 testSetData ()
 
 testSetHeader ()
 
 testSetUserAgent ()
 

Static Public Member Functions

static provideRelativeRedirects ()
 

Protected Member Functions

 assertHasCookie ( $expectedName, $expectedValue, CookieJar $cookieJar)
 Asserts that the cookie jar has the given cookie with the given value. More...
 
 assertNotHasCookie ( $name, CookieJar $cookieJar)
 Asserts that the cookie jar does not have the given cookie. More...
 
 assertResponseFieldValue ( $key, $expectedValue, MWHttpRequest $response)
 Verifies that the request was successful, returned valid JSON and the given field of that JSON data is as expected. More...
 

Protected Attributes

 $oldHttpEngine
 

Static Protected Attributes

static $httpEngine
 

Private Attributes

HttpRequestFactory $factory
 

Detailed Description

Definition at line 7 of file MWHttpRequestTestCase.php.

Member Function Documentation

◆ assertHasCookie()

MWHttpRequestTestCase::assertHasCookie (   $expectedName,
  $expectedValue,
CookieJar  $cookieJar 
)
protected

Asserts that the cookie jar has the given cookie with the given value.

Parameters
string$expectedNameCookie name
string$expectedValueCookie value
CookieJar$cookieJar

Definition at line 237 of file MWHttpRequestTestCase.php.

Referenced by testSetCookieJar().

◆ assertNotHasCookie()

MWHttpRequestTestCase::assertNotHasCookie (   $name,
CookieJar  $cookieJar 
)
protected

Asserts that the cookie jar does not have the given cookie.

Parameters
string$nameCookie name
CookieJar$cookieJar

Definition at line 251 of file MWHttpRequestTestCase.php.

References $name.

◆ assertResponseFieldValue()

MWHttpRequestTestCase::assertResponseFieldValue (   $key,
  $expectedValue,
MWHttpRequest  $response 
)
protected

Verifies that the request was successful, returned valid JSON and the given field of that JSON data is as expected.

Parameters
string|string[]$key Path to the data in the response object
mixed$expectedValue
MWHttpRequest$response

Definition at line 218 of file MWHttpRequestTestCase.php.

References as, MWHttpRequest\getContent(), MWHttpRequest\getStatus(), and true.

Referenced by testBasicAuthentication(), testgetFinalUrl(), testSetCookie(), testSetCookieJar(), testSetData(), testSetHeader(), and testSetUserAgent().

◆ provideRelativeRedirects()

static MWHttpRequestTestCase::provideRelativeRedirects ( )
static

Definition at line 257 of file MWHttpRequestTestCase.php.

References null.

◆ setUp()

MWHttpRequestTestCase::setUp ( )

◆ tearDown()

MWHttpRequestTestCase::tearDown ( )

Definition at line 34 of file MWHttpRequestTestCase.php.

References Http\$httpEngine, and $oldHttpEngine.

◆ testBasicAuthentication()

MWHttpRequestTestCase::testBasicAuthentication ( )

Definition at line 186 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

◆ testFactoryDefaults()

MWHttpRequestTestCase::testFactoryDefaults ( )

Definition at line 204 of file MWHttpRequestTestCase.php.

References $request, and class.

◆ testgetFinalUrl()

MWHttpRequestTestCase::testgetFinalUrl ( )

Definition at line 53 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

◆ testGetResponseHeaders()

MWHttpRequestTestCase::testGetResponseHeaders ( )

Definition at line 127 of file MWHttpRequestTestCase.php.

References $request.

◆ testGetStatus()

MWHttpRequestTestCase::testGetStatus ( )

Definition at line 144 of file MWHttpRequestTestCase.php.

References $request.

◆ testIsRedirect()

MWHttpRequestTestCase::testIsRedirect ( )

Definition at line 41 of file MWHttpRequestTestCase.php.

References $request.

◆ testRelativeRedirections()

MWHttpRequestTestCase::testRelativeRedirections (   $location,
  $final,
  $message = null 
)

provideRelativeRedirects MWHttpRequest::getFinalUrl

Definition at line 295 of file MWHttpRequestTestCase.php.

◆ testSetCallback()

MWHttpRequestTestCase::testSetCallback ( )

Definition at line 167 of file MWHttpRequestTestCase.php.

References $content, $request, and use.

◆ testSetCookie()

MWHttpRequestTestCase::testSetCookie ( )

Definition at line 88 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

◆ testSetCookieJar()

MWHttpRequestTestCase::testSetCookieJar ( )

Definition at line 97 of file MWHttpRequestTestCase.php.

References $request, assertHasCookie(), and assertResponseFieldValue().

◆ testSetData()

MWHttpRequestTestCase::testSetData ( )

Definition at line 159 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

◆ testSetHeader()

MWHttpRequestTestCase::testSetHeader ( )

Definition at line 136 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

◆ testSetUserAgent()

MWHttpRequestTestCase::testSetUserAgent ( )

Definition at line 151 of file MWHttpRequestTestCase.php.

References $request, and assertResponseFieldValue().

Member Data Documentation

◆ $factory

HttpRequestFactory MWHttpRequestTestCase::$factory
private

Definition at line 12 of file MWHttpRequestTestCase.php.

◆ $httpEngine

MWHttpRequestTestCase::$httpEngine
staticprotected

Definition at line 8 of file MWHttpRequestTestCase.php.

◆ $oldHttpEngine

MWHttpRequestTestCase::$oldHttpEngine
protected

Definition at line 9 of file MWHttpRequestTestCase.php.

Referenced by tearDown().


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