/**
  * Executes all validation tests defined by the given data provider
  * Not really testing, just mocking if everything is called as expected
  *
  * @test
  * @dataProvider settingsDataProvider
  */
 public function validatorReturnsExpectedResults($settings, $fields, $hasErrors, $expected)
 {
     $registration = new \DERHANSEN\SfEventMgt\Domain\Model\Registration();
     $registration->setFirstname('John');
     $registration->setLastname('Doe');
     $registration->setEmail('*****@*****.**');
     foreach ($fields as $key => $value) {
         $registration->_setProperty($key, $value);
     }
     // Inject configuration and configurationManager
     $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', ['getConfiguration'], [], '', false);
     $configurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue($settings));
     $this->inject($this->validator, 'configurationManager', $configurationManager);
     // Inject the object manager
     $validationError = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Error', [], [], '', false);
     $validationResult = $this->getMock('TYPO3\\CMS\\Extbase\\Error\\Result', [], [], '', false);
     $validationResult->expects($this->any())->method('hasErrors')->will($this->returnValue($hasErrors));
     $validationResult->expects($this->any())->method('getErrors')->will($this->returnValue([$validationError]));
     $notEmptyValidator = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\NotEmptyValidator', [], [], '', false);
     $notEmptyValidator->expects($this->any())->method('validate')->will($this->returnValue($validationResult));
     $booleanValidator = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\BooleanValidator', [], [], '', false);
     $booleanValidator->expects($this->any())->method('validate')->will($this->returnValue($validationResult));
     $recaptchaValidator = $this->getMock('DERHANSEN\\SfEventMgt\\Validation\\Validator\\RecaptchaValidator', [], [], '', false);
     $recaptchaValidator->expects($this->any())->method('validate')->will($this->returnValue($validationResult));
     // Create a map of arguments to return values
     $map = [['string', 'city', $notEmptyValidator], ['string', 'zip', $notEmptyValidator], ['string', 'recaptcha', $recaptchaValidator], ['boolean', 'accepttc', $booleanValidator]];
     $this->validator->expects($this->any())->method('getValidator')->will($this->returnValueMap($map));
     $this->assertEquals($expected, $this->validator->validate($registration)->hasErrors());
 }
 /**
  * @test
  */
 public function validateReturnsNoErrorIfTheGivenValueIsAnEmptyString()
 {
     $this->assertFalse($this->validator->validate('')->hasErrors());
 }