PHP Class PHPUnit_Framework_Constraint_ArrayHasKey, qcodo

Uses array_key_exists() to check if the key is found in the input array, if not found the evaluation fails. The array key is passed in the constructor.
Inheritance: extends PHPUnit_Framework_Constraint
Show file Open project: qcodo/qcodo Class Usage Examples

Protected Properties

Property Type Description
$key integer | string

Public Methods

Method Description
__construct ( integer | string $key )
evaluate ( mixed $other ) : boolean Evaluates the constraint for parameter $other. Returns TRUE if the constraint is met, FALSE otherwise.
toString ( ) : string Returns a string representation of the constraint.

Protected Methods

Method Description
customFailureDescription ( mixed $other, string $description, boolean $not )

Method Details

__construct() public method

public __construct ( integer | string $key )
$key integer | string

customFailureDescription() protected method

protected customFailureDescription ( mixed $other, string $description, boolean $not )
$other mixed
$description string
$not boolean

evaluate() public method

Evaluates the constraint for parameter $other. Returns TRUE if the constraint is met, FALSE otherwise.
public evaluate ( mixed $other ) : boolean
$other mixed Value or object to evaluate.
return boolean

toString() public method

Returns a string representation of the constraint.
public toString ( ) : string
return string

Property Details

$key protected property

protected int|string $key
return integer | string