public function testFilterLineNumbers()
{
$this->filter->throwExceptions();
$item = array('foo' => 'bar');
$violation = $this->getMock('Symfony\\Component\\Validator\\ConstraintViolationInterface');
$list = new ConstraintViolationList(array($violation));
$this->validator->expects($this->exactly(2))->method('validate')->willReturn($list);
try {
$this->assertTrue(call_user_func($this->filter, $item));
$this->fail('ValidationException should be thrown (1)');
} catch (ValidationException $e) {
$this->assertSame(1, $e->getLineNumber());
$this->assertEquals($list, $e->getViolations());
}
try {
$this->assertTrue(call_user_func($this->filter, $item));
$this->fail('ValidationException should be thrown (2)');
} catch (ValidationException $e) {
$this->assertSame(2, $e->getLineNumber());
$this->assertEquals($list, $e->getViolations());
}
}