Documentation

SavingConsentViaRestApiEndpointChecker
in package

This class allows you to simulate a call to the REST API which saves consent and check if saving worked as expected. It analyzes the result of the request response when the request failed and returns suggestions, if available.

Table of Contents

Constants

ERROR_DIAGNOSTIC_403_FORBIDDEN_HTACCESS_DENY  = '403htaccessDeny'
ERROR_DIAGNOSTIC_COOKIE_HTTP_ONLY  = 'cookieHttpOnly'
ERROR_DIAGNOSTIC_COOKIE_PATH  = 'cookiePath'
ERROR_DIAGNOSTIC_ERROR_CODE  = 'errorCode'
ERROR_DIAGNOSTIC_NO_COOKIES  = 'noCookies'
ERROR_DIAGNOSTIC_REDIRECT  = 'redirect'
ERROR_DIAGNOSTIC_RESPONSE_BODY  = 'responseBody'
RETRY_IN_SECONDS  = 60 * 30
RETRY_IN_SECONDS_WHEN_NON_BLOCKING_REQUEST_STARTED  = 20
RETRY_IN_SECONDS_WHEN_OPERATION_TIMED_OUT  = 20

Properties

$requestArguments  : mixed
$result  : mixed
$start  : float
Start time.

Methods

__construct()  : mixed
C'tor.
addError()  : mixed
Add custom error to the tests if you e.g. want to add network errors.
getRequestArguments()  : mixed
Getter.
received()  : mixed
Call this method directly after you do the dummy REST API call.
setRequestArgument()  : mixed
Setter.
shouldInvalidate()  : mixed
Pass a cached result of the process and check if a request should be sent again.
start()  : mixed
Call this method directly before you do the dummy REST API call.
teardown()  : mixed
Get the result which you can persist to your database.
parseCookiesFromHeaders()  : array<string|int, Cookie>
Parse the `Set-cookie` headers to a valid `Cookie` instance, but only the cookies starting with `real_cookie_banner`.

Constants

Properties

$requestArguments

private mixed $requestArguments = ['body' => ['dummy' => true, 'buttonClicked' => 'main_all', 'decision' => [2 => [3]], 'gcmConsent' => ['ad_storage'], 'tcfString' => 'TCFSTRING=='], 'cookies' => [], 'headers' => [], 'redirection' => 0, 'timeout' => 20, 'sslverify' => true]

Methods

addError()

Add custom error to the tests if you e.g. want to add network errors.

public addError(string $url, string|array<string|int, string> $error) : mixed
Parameters
$url : string
$error : string|array<string|int, string>

received()

Call this method directly after you do the dummy REST API call.

public received(string $url, string $bodyString, array<string|int, mixed> $headers, int $code[, array<string|int, mixed> $args = [] ]) : mixed

Additional arguments:

string       'htaccess'         The content of the .htaccess file for checks when the response receives a 403 Forbidden error
string[]     'internalIps'      An string array of all internal IPs, needed for `htaccess`
Parameters
$url : string
$bodyString : string

The response body

$headers : array<string|int, mixed>

The response headers

$code : int

The response status code

$args : array<string|int, mixed> = []

Additional arguments

shouldInvalidate()

Pass a cached result of the process and check if a request should be sent again.

public shouldInvalidate(array<string|int, mixed> $cachedResult) : mixed
Parameters
$cachedResult : array<string|int, mixed>

start()

Call this method directly before you do the dummy REST API call.

public start(string $url, bool $nonBlockingRequestStarted) : mixed
Parameters
$url : string

The full URL where the POST request gets sent

$nonBlockingRequestStarted : bool

Has a non-blocking request started concurrently which could potentially dead-lock our request?


        
On this page

Search results