You are here

public function AbstractLegacyApiTest::testRecursiveTraversableRecursiveTraversalDisabled in Plug 7

@expectedException \Symfony\Component\Validator\Exception\NoSuchMetadataException

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Validator/AbstractLegacyApiTest.php, line 99

Class

AbstractLegacyApiTest
Verifies that a validator satisfies the API of Symfony < 2.5.

Namespace

Symfony\Component\Validator\Tests\Validator

Code

public function testRecursiveTraversableRecursiveTraversalDisabled() {
  $test = $this;
  $entity = new Entity();
  $traversable = new \ArrayIterator(array(
    2 => new \ArrayIterator(array(
      'key' => $entity,
    )),
  ));
  $callback = function () use ($test) {
    $test
      ->fail('Should not be called');
  };
  $this->metadata
    ->addConstraint(new Callback(array(
    'callback' => $callback,
    'groups' => 'Group',
  )));
  $this->validator
    ->validate($traversable, 'Group');
}