You are here

public function Abstract2Dot5ApiTest::testLegacyPropertyMetadataMustImplementPropertyMetadataInterface in Plug 7

@expectedException \Symfony\Component\Validator\Exception\UnsupportedMetadataException @group legacy

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php, line 638

Class

Abstract2Dot5ApiTest
Verifies that a validator satisfies the API of Symfony 2.5+.

Namespace

Symfony\Component\Validator\Tests\Validator

Code

public function testLegacyPropertyMetadataMustImplementPropertyMetadataInterface() {
  $this
    ->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
  $entity = new Entity();

  // Legacy interface
  $propertyMetadata = $this
    ->getMock('Symfony\\Component\\Validator\\MetadataInterface');
  $metadata = new FakeClassMetadata(get_class($entity));
  $metadata
    ->addCustomPropertyMetadata('firstName', $propertyMetadata);
  $this->metadataFactory
    ->addMetadata($metadata);
  $this->validator
    ->validate($entity);
}