/**
  * @test
  */
 public function errorTemplate()
 {
     $value1 = '123';
     $value2 = '456';
     $key1 = 'abc';
     $key2 = 'def';
     $name1 = 'First Field';
     $name2 = 'Second Field';
     $cage = [$key1 => $value1, $key2 => $value2];
     $validator = new ValidatorService($cage);
     $validator->setRule($key1, $name1, 'required|alphanumeric')->setRule($key2, $name2, 'required|alphanumeric|matches[' . $key1 . ']');
     $validator->run();
     $errors = $validator->getAllFieldErrorMessages();
     // Ensure the second field has failed, not the first
     $this->assertArrayHasKey($key2, $errors);
     $this->assertArrayNotHasKey($key1, $errors);
     $message = $errors[$key2];
     $this->assertStringStartsWith($name2, $message);
     $this->assertStringEndsWith($name1, $message);
 }
 /**
  * @test
  * @dataProvider issetOnFieldAsPropertyBadProvider
  */
 public function issetOnFieldAsPropertyBad($set_field, $check_field, $expected_exception)
 {
     $data = [$set_field => 'Some data'];
     $validator = new ValidatorService($data);
     $validator->setRule($check_field, 'Field Under Test', 'required|minLength[1]');
     if ($expected_exception !== 'Behance\\NBD\\Validation\\Exceptions\\Validator\\NotRunException') {
         $validator->run();
     }
     $this->setExpectedException($expected_exception);
     // Invocation
     isset($validator->{$set_field});
 }