Documentation

StateHttpTest extends TestCase
in package

State::fromRequest() against real HTTP requests. PHP's built-in web server runs fixtures/state-server.php, which answers with PHP's own view of the request next to the state, so the two can be compared for whatever a client sends.

Table of Contents

DECODE_PREFIX  = "<#decURI#>"
FALLBACK  = ["variables_order=EGPCS"]
NO_SOURCE  = ["request_order=", "variables_order=EGPCS"]
PRODUCTION  = ["request_order=GP", "variables_order=GPCS"]
$addresses  : array<string|int, mixed>
$servers  : array<string|int, mixed>
bodies()  : array<string|int, mixed>
methodsWithABody()  : array<string|int, mixed>
queries()  : array<string|int, mixed>
servers()  : array<string|int, mixed>
setUpBeforeClass()  : void
tearDownAfterClass()  : void
testAnEmptyBodyIsNull()  : void
testAPrefixedValueIsDecodedInThePostAndInTheRequest()  : void
testARequestThatIsPutTogetherAgainEqualsTheOneOfPhp()  : void
testARequestWithoutAQueryHasAnEmptyGet()  : void
testAStateBuiltFromTheUriOfARequestEqualsTheRequest()  : void
testTheAuthorizationHeaderReachesTheState()  : void
testTheBodyArrivesUnchanged()  : void
testTheBodyOfAFormIsTheFormAsItWasSent()  : void
testTheBodyOfEveryMethodIsRead()  : void
testTheHeadersOfTheRequestReachTheState()  : void
testThePostWinsOverTheQueryInTheRequestAlsoForNumericKeys()  : void
testTheRequestFollowsTheRequestOrderOfPhp()  : void
testTheRequestFollowsTheVariablesOrderWithoutARequestOrder()  : void
testTheRequestIsEmptyForARequestOrderThatIsSetToNothing()  : void
testTheStateHoldsAnUploadLikePhpDoes()  : void
testTheStateHoldsAPostedFormLikePhpDoes()  : void
testTheStateHoldsTheCookiesLikePhpDoes()  : void
testTheStateHoldsTheQueryLikePhpDoes()  : void
setUp()  : void
send()  : array<string, mixed>
sendForm()  : array<string|int, mixed>
startServer()  : void

Constants

NO_SOURCE

private mixed NO_SOURCE = ["request_order=", "variables_order=EGPCS"]

PRODUCTION

private mixed PRODUCTION = ["request_order=GP", "variables_order=GPCS"]

Properties

$addresses

private static array<string|int, mixed> $addresses = []

$servers

private static array<string|int, mixed> $servers = []

Methods

bodies()

public static bodies() : array<string|int, mixed>
Return values
array<string|int, mixed> —

methodsWithABody()

public static methodsWithABody() : array<string|int, mixed>
Return values
array<string|int, mixed> —

queries()

public static queries() : array<string|int, mixed>
Return values
array<string|int, mixed> —

servers()

public static servers() : array<string|int, mixed>
Return values
array<string|int, mixed> —

setUpBeforeClass()

public static setUpBeforeClass() : void
Return values
void —

tearDownAfterClass()

public static tearDownAfterClass() : void
Return values
void —

testAnEmptyBodyIsNull()

public testAnEmptyBodyIsNull() : void
Return values
void —

testAPrefixedValueIsDecodedInThePostAndInTheRequest()

public testAPrefixedValueIsDecodedInThePostAndInTheRequest() : void
Return values
void —

testARequestThatIsPutTogetherAgainEqualsTheOneOfPhp()

public testARequestThatIsPutTogetherAgainEqualsTheOneOfPhp(string $server) : void
Parameters
$server : string
Tags
dataProvider

servers

Return values
void —

testARequestWithoutAQueryHasAnEmptyGet()

public testARequestWithoutAQueryHasAnEmptyGet() : void
Return values
void —

testAStateBuiltFromTheUriOfARequestEqualsTheRequest()

public testAStateBuiltFromTheUriOfARequestEqualsTheRequest(string $query) : void
Parameters
$query : string
Tags
dataProvider

queries

Return values
void —

testTheAuthorizationHeaderReachesTheState()

public testTheAuthorizationHeaderReachesTheState() : void
Return values
void —

testTheBodyArrivesUnchanged()

public testTheBodyArrivesUnchanged(string $body) : void
Parameters
$body : string
Tags
dataProvider

bodies

Return values
void —

testTheBodyOfAFormIsTheFormAsItWasSent()

public testTheBodyOfAFormIsTheFormAsItWasSent() : void
Return values
void —

testTheBodyOfEveryMethodIsRead()

public testTheBodyOfEveryMethodIsRead(string $method) : void
Parameters
$method : string
Tags
dataProvider

methodsWithABody

Return values
void —

testTheHeadersOfTheRequestReachTheState()

public testTheHeadersOfTheRequestReachTheState() : void
Return values
void —

testThePostWinsOverTheQueryInTheRequestAlsoForNumericKeys()

public testThePostWinsOverTheQueryInTheRequestAlsoForNumericKeys() : void
Return values
void —

testTheRequestFollowsTheRequestOrderOfPhp()

public testTheRequestFollowsTheRequestOrderOfPhp() : void
Return values
void —

testTheRequestFollowsTheVariablesOrderWithoutARequestOrder()

public testTheRequestFollowsTheVariablesOrderWithoutARequestOrder() : void
Return values
void —

testTheRequestIsEmptyForARequestOrderThatIsSetToNothing()

public testTheRequestIsEmptyForARequestOrderThatIsSetToNothing() : void
Return values
void —

testTheStateHoldsAnUploadLikePhpDoes()

public testTheStateHoldsAnUploadLikePhpDoes() : void
Return values
void —

testTheStateHoldsAPostedFormLikePhpDoes()

public testTheStateHoldsAPostedFormLikePhpDoes() : void
Return values
void —

testTheStateHoldsTheCookiesLikePhpDoes()

public testTheStateHoldsTheCookiesLikePhpDoes() : void
Return values
void —

testTheStateHoldsTheQueryLikePhpDoes()

public testTheStateHoldsTheQueryLikePhpDoes(string $query) : void
Parameters
$query : string
Tags
dataProvider

queries

Return values
void —

send()

private send(string $method, string $uri[, array<string|int, string> $headers = [] ][, string|null $body = null ][, string $server = "production" ]) : array<string, mixed>
Parameters
$method : string
$uri : string
$headers : array<string|int, string> = []
$body : string|null = null
$server : string = "production"
Return values
array<string, mixed> —

What the server answered

sendForm()

private sendForm(string $uri, string $form[, array<string|int, string> $headers = [] ][, string $server = "production" ]) : array<string|int, mixed>
Parameters
$uri : string
$form : string
$headers : array<string|int, string> = []
$server : string = "production"
Return values
array<string|int, mixed> —

startServer()

private static startServer(string $name, array<string|int, string> $settings) : void
Parameters
$name : string
$settings : array<string|int, string>

php.ini settings of the server

Return values
void —

Search results