You are here

public function AbstractLegacyApiTest::testTraversableTraverseDisabled in Zircon Profile 8

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

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

File

vendor/symfony/validator/Tests/Validator/AbstractLegacyApiTest.php, line 78

Class

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

Namespace

Symfony\Component\Validator\Tests\Validator

Code

public function testTraversableTraverseDisabled() {
  $test = $this;
  $entity = new Entity();
  $traversable = 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');
}