Open Journal Systems  3.3.0
Guzzle\Tests\Http\Message\HeaderComparison Class Reference

Public Member Functions

 compare ($filteredHeaders, $actualHeaders)
 
 compareArray (array $expected, $actual, array $ignore=array(), array $absent=array())
 

Protected Member Functions

 hasKey ($key, $array)
 

Detailed Description

Class used to compare HTTP headers using a custom DSL

Definition at line 11 of file HeaderComparison.php.

Member Function Documentation

◆ compare()

Guzzle\Tests\Http\Message\HeaderComparison::compare (   $filteredHeaders,
  $actualHeaders 
)

Compare HTTP headers and use special markup to filter values A header prefixed with '!' means it must not exist A header prefixed with '_' means it must be ignored A header value of '*' means anything after the * will be ignored

Parameters
array$filteredHeadersArray of special headers
array$actualHeadersArray of headers to check against
Returns
array|bool Returns an array of the differences or FALSE if none

Definition at line 24 of file HeaderComparison.php.

References Guzzle\Tests\Http\Message\HeaderComparison\compareArray().

◆ compareArray()

Guzzle\Tests\Http\Message\HeaderComparison::compareArray ( array  $expected,
  $actual,
array  $ignore = array(),
array  $absent = array() 
)

Check if an array of HTTP headers matches another array of HTTP headers while taking * into account as a wildcard

Parameters
array$expectedExpected HTTP headers (allows wildcard values)
array | Collection$actualActual HTTP header array
array$ignoreHeaders to ignore from the comparison
array$absentArray of headers that must not be present
Returns
array|bool Returns an array of the differences or FALSE if none

Definition at line 59 of file HeaderComparison.php.

References Guzzle\Tests\Http\Message\HeaderComparison\hasKey().

Referenced by Guzzle\Tests\Http\Message\HeaderComparison\compare().

◆ hasKey()

Guzzle\Tests\Http\Message\HeaderComparison::hasKey (   $key,
  $array 
)
protected

Case insensitive check if an array have a key

Parameters
string$keyKey to check
array$arrayArray to check
Returns
bool

Definition at line 119 of file HeaderComparison.php.

Referenced by Guzzle\Tests\Http\Message\HeaderComparison\compareArray().


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