本文整理汇总了PHP中PHPUnit_Framework_Assert::matchesRegularExpression方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::matchesRegularExpression方法的具体用法?PHP PHPUnit_Framework_Assert::matchesRegularExpression怎么用?PHP PHPUnit_Framework_Assert::matchesRegularExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::matchesRegularExpression方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchesRegularExpression
/**
* Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object.
*
* @param string $pattern
* @return PHPUnit_Framework_Constraint_PCREMatch
* @since Method available since Release 3.0.0
*/
function matchesRegularExpression($pattern)
{
return PHPUnit_Framework_Assert::matchesRegularExpression($pattern);
}
示例2: testConstraintPCRENotMatch2
/**
* @covers PHPUnit_Framework_Constraint_PCREMatch
* @covers PHPUnit_Framework_Constraint_Not
* @covers PHPUnit_Framework_Assert::matchesRegularExpression
* @covers PHPUnit_Framework_Assert::logicalNot
*/
public function testConstraintPCRENotMatch2()
{
$constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::matchesRegularExpression('/foo/'));
try {
$constraint->fail('barfoobar', 'custom message', TRUE);
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this->assertEquals("custom message\nFailed asserting that <string:barfoobar> does not match PCRE pattern \"/foo/\".", $e->getDescription());
return;
}
$this->fail();
}
示例3: hasContentType
function hasContentType($contentType)
{
return new HasHeaderConstraint('Content-Type', Assert::matchesRegularExpression(',^' . preg_quote($contentType) . '(;.+)?$,'));
}
示例4: testConstraintPCRENotMatch2
/**
* @covers PHPUnit_Framework_Constraint_PCREMatch
* @covers PHPUnit_Framework_Constraint_Not
* @covers PHPUnit_Framework_Assert::matchesRegularExpression
* @covers PHPUnit_Framework_Assert::logicalNot
* @covers PHPUnit_Framework_TestFailure::exceptionToString
*/
public function testConstraintPCRENotMatch2()
{
$constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::matchesRegularExpression('/foo/'));
try {
$constraint->evaluate('barfoobar', 'custom message');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this->assertEquals(<<<EOF
custom message
Failed asserting that 'barfoobar' does not match PCRE pattern "/foo/".
EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
return;
}
$this->fail();
}
示例5: bodyMatchesJson
public static function bodyMatchesJson(array $constraints)
{
return Assert::logicalAnd(self::hasHeader('content-type', Assert::matchesRegularExpression(',^application/json(;.+)?$,')), self::bodyMatches(Assert::logicalAnd(Assert::isJson(), new JsonValueMatchesMany($constraints))));
}