You are here

public function CollectionValidatorTest::testRequiredFieldNotPresent in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php, line 309

Class

CollectionValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testRequiredFieldNotPresent() {
  $data = $this
    ->prepareTestData(array());
  $this->validator
    ->validate($data, new Collection(array(
    'fields' => array(
      'foo' => new Required(),
    ),
    'missingFieldsMessage' => 'myMessage',
  )));
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ field }}', '"foo"')
    ->atPath('property.path[foo]')
    ->setInvalidValue(null)
    ->setCode(Collection::MISSING_FIELD_ERROR)
    ->assertRaised();
}