Documentation

PHPUnit_Framework_Constraint_StringMatches extends PHPUnit_Framework_Constraint_PCREMatch
in package

Constraint that asserts that the string it is evaluated for matches a regular expression.

...

Tags
since

Class available since Release 3.5.0

Table of Contents

$exporter  : mixed
$pattern  : string
$string  : string
__construct()  : mixed
count()  : int
Counts the number of constraint elements.
evaluate()  : mixed
Evaluates the constraint for parameter $other
toString()  : string
Returns a string representation of the constraint.
additionalFailureDescription()  : mixed
createPatternFromFormat()  : mixed
fail()  : mixed
Throws an exception for the given compared value and test description
failureDescription()  : mixed
matches()  : bool
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

Properties

Methods

__construct()

public __construct(string $string) : mixed
Parameters
$string : string
Return values
mixed

count()

Counts the number of constraint elements.

public count() : int
Tags
since

Method available since Release 3.4.0

Return values
int

evaluate()

Evaluates the constraint for parameter $other

public evaluate(mixed $other[, string $description = '' ][, bool $returnResult = false ]) : mixed

If $returnResult is set to false (the default), an exception is thrown in case of a failure. null is returned otherwise.

If $returnResult is true, the result of the evaluation is returned as a boolean value instead: true in case of success, false in case of a failure.

Parameters
$other : mixed

Value or object to evaluate.

$description : string = ''

Additional information about the test

$returnResult : bool = false

Whether to return a result or throw an exception

Tags
throws
PHPUnit_Framework_ExpectationFailedException
Return values
mixed

toString()

Returns a string representation of the constraint.

public toString() : string
Return values
string

additionalFailureDescription()

protected additionalFailureDescription(mixed $other) : mixed
Parameters
$other : mixed
Return values
mixed

createPatternFromFormat()

protected createPatternFromFormat(mixed $string) : mixed
Parameters
$string : mixed
Return values
mixed

failureDescription()

protected failureDescription(mixed $other) : mixed
Parameters
$other : mixed
Return values
mixed

matches()

Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

protected matches(mixed $other) : bool

This method can be overridden to implement the evaluation algorithm.

Parameters
$other : mixed

Value or object to evaluate.

Return values
bool

Search results