You are here

public function YamlFileLoaderTest::testDoNotModifyStateIfExceptionIsThrown in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php \Symfony\Component\Validator\Tests\Mapping\Loader\YamlFileLoaderTest::testDoNotModifyStateIfExceptionIsThrown()

See also

https://github.com/symfony/symfony/pull/12158

File

vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php, line 59

Class

YamlFileLoaderTest

Namespace

Symfony\Component\Validator\Tests\Mapping\Loader

Code

public function testDoNotModifyStateIfExceptionIsThrown() {
  $loader = new YamlFileLoader(__DIR__ . '/nonvalid-mapping.yml');
  $metadata = new ClassMetadata('Symfony\\Component\\Validator\\Tests\\Fixtures\\Entity');
  try {
    $loader
      ->loadClassMetadata($metadata);
  } catch (\InvalidArgumentException $e) {

    // Call again. Again an exception should be thrown
    $this
      ->setExpectedException('\\InvalidArgumentException');
    $loader
      ->loadClassMetadata($metadata);
  }
}