public function CollectionValidatorTest::testExtraFieldsDisallowed

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php, line 140

Class

CollectionValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testExtraFieldsDisallowed() {
  $data = $this
    ->prepareTestData(array(
    'foo' => 5,
    'baz' => 6,
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolationAt')
    ->with('[baz]', 'myMessage', array(
    '{{ field }}' => 'baz',
  ));
  $this->validator
    ->validate($data, new Collection(array(
    'fields' => array(
      'foo' => new Range(array(
        'min' => 4,
      )),
    ),
    'extraFieldsMessage' => 'myMessage',
  )));
}