@@ -575,7 +575,7 @@ public function testSeeResponseJsonXpathEvaluatesToBoolean()
575
575
$ this ->setStubResponse ('{"success": 1} ' );
576
576
$ this ->module ->seeResponseJsonXpathEvaluatesTo ('count(//success) > 0 ' , true );
577
577
}
578
-
578
+
579
579
public function testSeeResponseJsonXpathEvaluatesToNumber ()
580
580
{
581
581
$ this ->setStubResponse ('{"success": 1} ' );
@@ -587,7 +587,7 @@ public function testDontSeeResponseJsonXpathEvaluatesToBoolean()
587
587
$ this ->setStubResponse ('{"success": 1} ' );
588
588
$ this ->module ->dontSeeResponseJsonXpathEvaluatesTo ('count(//success) > 0 ' , false );
589
589
}
590
-
590
+
591
591
public function testDontSeeResponseJsonXpathEvaluatesToNumber ()
592
592
{
593
593
$ this ->setStubResponse ('{"success": 1} ' );
@@ -649,7 +649,7 @@ public function testHaveServerParameter()
649
649
* @dataProvider schemaAndResponse
650
650
*/
651
651
652
- public function testSeeResponseIsValidOnJsonSchemachesJsonSchema (string $ schema , string $ response , bool $ outcome , string $ error )
652
+ public function testSeeResponseIsValidOnJsonSchemaMatchesJsonSchema (string $ schema , string $ response , bool $ outcome , string $ error )
653
653
{
654
654
$ response = file_get_contents (codecept_data_dir ($ response ));
655
655
$ this ->setStubResponse ($ response );
@@ -662,7 +662,7 @@ public function testSeeResponseIsValidOnJsonSchemachesJsonSchema(string $schema,
662
662
$ this ->module ->seeResponseIsValidOnJsonSchema (codecept_data_dir ($ schema ));
663
663
}
664
664
665
- public function testSeeResponseIsValidOnJsonSchemachesJsonSchemaString ()
665
+ public function testSeeResponseIsValidOnJsonSchemaMatchesJsonSchemaString ()
666
666
{
667
667
$ this ->setStubResponse ('{"name": "john", "age": 20} ' );
668
668
$ this ->module ->seeResponseIsValidOnJsonSchemaString ('{"type": "object"} ' );
@@ -678,6 +678,14 @@ public function testSeeResponseIsValidOnJsonSchemachesJsonSchemaString()
678
678
$ this ->module ->seeResponseIsValidOnJsonSchemaString (json_encode ($ schema , JSON_THROW_ON_ERROR ));
679
679
}
680
680
681
+ public function testSeeResponseIsInvalidOnJsonSchemaMatchesJsonSchemaString ()
682
+ {
683
+ $ this ->setStubResponse ('{"name": null, "age": 20} ' );
684
+ $ this ->expectExceptionMessage ("[Property: 'name'] NULL value found, but a string is required " );
685
+ $ this ->shouldFail ();
686
+ $ this ->module ->seeResponseIsValidOnJsonSchemaString ('{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}} ' );
687
+ }
688
+
681
689
/**
682
690
* @dataProvider configAndRequestUrls
683
691
*/
0 commit comments