match() public method

{@inheritDoc}
public match ( $value, $pattern )
Ejemplo n.º 1
0
 public function test_error_when_path_in_nested_value_does_not_exist()
 {
     $value = json_encode(array('foo' => array('bar' => array())));
     $pattern = json_encode(array('foo' => array('bar' => array('faz' => 'faz value'))));
     $this->assertFalse($this->matcher->match($value, $pattern));
     $this->assertEquals($this->matcher->getError(), 'There is no element under path [foo][bar][faz] in value.');
 }
Ejemplo n.º 2
0
 public function test_error_when_json_value_is_invalid()
 {
     $value = '{"test": "value",}';
     $pattern = '{"test": "@string@"}';
     $this->assertFalse($this->matcher->match($value, $pattern));
     $this->assertEquals($this->matcher->getError(), 'Invalid given JSON of value. Syntax error, malformed JSON');
 }