isJson() public static method

Returns a PHPUnit_Framework_Constraint_IsJson matcher object.
public static isJson ( ) : PHPUnit_Framework_Constraint_IsJson
return PHPUnit_Framework_Constraint_IsJson
コード例 #1
0
ファイル: Expect.php プロジェクト: jasonmccreary/expect
 public function toBeJson()
 {
     if ($this->negate) {
         a::assertThat($this->actual, a::logicalAnd(a::isType('string'), a::logicalNot(a::isJson())));
     } else {
         a::assertJson($this->actual);
     }
 }
コード例 #2
0
function bodyMatchesJson($constraints)
{
    return Assert::logicalAnd(hasContentType('application/json'), bodyMatches(Assert::logicalAnd(Assert::isJson(), new JsonValueMatchesMany($constraints))));
}
コード例 #3
0
 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))));
 }