public function objectsAreValidatedOnlyOnce()
{
$className = 'A' . md5(uniqid(mt_rand(), true));
eval('class ' . $className . '{ public $integer = 1; }');
$object = new $className();
$integerValidator = $this->getAccessibleMock(IntegerValidator::class);
$matcher = $this->any();
$integerValidator->expects($matcher)->method('validate')->with(1)->will($this->returnValue(new Error\Result()));
$validator = $this->getValidator();
$validator->addPropertyValidator('integer', $integerValidator);
// Call the validation twice
$validator->validate($object);
$validator->validate($object);
$this->assertEquals(1, $matcher->getInvocationCount());
}