HasPregCapturesTrait
trait HasPregCapturesTrait
Methods
Evaluates a \PHPUnit\Framework\Constraint\Constraint matcher object.
Asserts that an array of $matches returned from preg_match()
has
capture groups as specified in $expected.
Negated assertHasPregCaptures().
Accepts arrays of matches returned from preg_match()
having capture
groups as specified in $excpected.
Details
at line 29
abstract static void
assertThat(mixed $value, Constraint $constraint, string $message = '')
Evaluates a \PHPUnit\Framework\Constraint\Constraint matcher object.
at line 57
static void
assertHasPregCaptures(array $expected, array $matches, string $message = '')
Asserts that an array of $matches returned from preg_match()
has
capture groups as specified in $expected.
Checks only entries present in $expected, so $expected = [] accepts any array. Special values may be used in the expectations:
['foo' => false]
asserts that group'foo'
was not captured,['foo' => true]
asserts that group'foo'
was captured,['foo' => 'FOO']
asserts that group'foo'
was captured and it's value equals'FOO'
.
Boolean expectations (['foo' => true]
or ['foo' => false]
) work
properly only with arrays obtained from preg_match()
invoked with
PREG_UNMATCHED_AS_NULL
flag.
at line 76
static void
assertNotHasPregCaptures(array $expected, array $matches, string $message = '')
Negated assertHasPregCaptures().
at line 98
static HasPregCaptures
hasPregCaptures(array $expected)
Accepts arrays of matches returned from preg_match()
having capture
groups as specified in $excpected.
Checks only entries present in $expected, so $expected = [] accepts any array. Special values may be used in the expectations:
['foo' => false]
asserts that group'foo'
was not captured,['foo' => true]
asserts that group'foo'
was captured,['foo' => 'FOO']
asserts that group'foo'
was captured and its value equals'FOO'
.
Boolean expectations (['foo' => true]
or ['foo' => false]
) work
properly only with arrays obtained from preg_match()
invoked with
PREG_UNMATCHED_AS_NULL
flag.