Skip to content

Commit d57de79

Browse files
partikusnorberttech
authored andcommitted
#82 Null not work correctly - added test case (#84)
* \#82 Null not work correctly - added test case * Refactor of null examples
1 parent a48618c commit d57de79

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/MatcherTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,26 @@ public static function orExamples()
263263
array(1, "@integer@.greaterThan(10)||@string@.contains(\"10\")", false),
264264
);
265265
}
266+
267+
/**
268+
* @dataProvider nullExamples
269+
*/
270+
public function test_null_value_in_the_json($value, $pattern)
271+
{
272+
$factory = new SimpleFactory();
273+
$matcher = $factory->createMatcher();
274+
$match = $matcher->match($value, $pattern);
275+
$this->assertTrue($match, $matcher->getError());
276+
}
277+
278+
public static function nullExamples()
279+
{
280+
return array(
281+
array(
282+
'{"proformaInvoiceLink":null}', '{"proformaInvoiceLink":null}',
283+
'{"proformaInvoiceLink":null, "test":"test"}', '{"proformaInvoiceLink":null, "test":"@string@"}',
284+
'{"proformaInvoiceLink":null, "test":"test"}', '{"proformaInvoiceLink":@null@, "test":"@string@"}',
285+
)
286+
);
287+
}
266288
}

0 commit comments

Comments
 (0)