Esempio n. 1
0
 private function getInvalidMatch()
 {
     $setScore = new SetScore();
     $setScore->setTeamAScore(-1);
     $setScore->setTeamBScore(-1);
     $match = new Match();
     $match->addSetScore($setScore);
     return $match;
 }
Esempio n. 2
0
 public function testFailsValidationWithWrongScore()
 {
     $setScore = new SetScore();
     $setScore->setTeamAScore(-1);
     $setScore->setTeamBScore(-1);
     $validator = Validation::createValidatorBuilder()->addMethodMapping('loadValidatorMetadata')->getValidator();
     $validationErrors = $validator->validate($setScore);
     $this->assertSame(2, $validationErrors->count());
     $this->assertSame('teamAScore', $validationErrors->get(0)->getPropertyPath());
     $this->assertSame('teamBScore', $validationErrors->get(1)->getPropertyPath());
 }