You are here

public function CollectionValidatorTest::testRequiredFieldNotPresent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\CollectionValidatorTest::testRequiredFieldNotPresent()

File

vendor/symfony/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();
}