You are here

class YamlFileLoaderTest in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\Routing\Tests\Loader\YamlFileLoaderTest
  2. 8 vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\Translation\Tests\Loader\YamlFileLoaderTest
  3. 8 vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\YamlFileLoaderTest
  4. 8 vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php \Symfony\Component\Validator\Tests\Mapping\Loader\YamlFileLoaderTest
  5. 8 vendor/symfony/serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php \Symfony\Component\Serializer\Tests\Mapping\Loader\YamlFileLoaderTest
Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php \Symfony\Component\Serializer\Tests\Mapping\Loader\YamlFileLoaderTest

@author Kévin Dunglas <dunglas@gmail.com>

Hierarchy

  • class \Symfony\Component\Serializer\Tests\Mapping\Loader\YamlFileLoaderTest extends \Symfony\Component\Serializer\Tests\Mapping\Loader\PHPUnit_Framework_TestCase

Expanded class hierarchy of YamlFileLoaderTest

File

vendor/symfony/serializer/Tests/Mapping/Loader/YamlFileLoaderTest.php, line 21

Namespace

Symfony\Component\Serializer\Tests\Mapping\Loader
View source
class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase {

  /**
   * @var YamlFileLoader
   */
  private $loader;

  /**
   * @var ClassMetadata
   */
  private $metadata;
  protected function setUp() {
    $this->loader = new YamlFileLoader(__DIR__ . '/../../Fixtures/serialization.yml');
    $this->metadata = new ClassMetadata('Symfony\\Component\\Serializer\\Tests\\Fixtures\\GroupDummy');
  }
  public function testInterface() {
    $this
      ->assertInstanceOf('Symfony\\Component\\Serializer\\Mapping\\Loader\\LoaderInterface', $this->loader);
  }
  public function testLoadClassMetadataReturnsTrueIfSuccessful() {
    $this
      ->assertTrue($this->loader
      ->loadClassMetadata($this->metadata));
  }
  public function testLoadClassMetadataReturnsFalseWhenEmpty() {
    $loader = new YamlFileLoader(__DIR__ . '/../../Fixtures/empty-mapping.yml');
    $this
      ->assertFalse($loader
      ->loadClassMetadata($this->metadata));
  }

  /**
   * @expectedException \Symfony\Component\Serializer\Exception\MappingException
   */
  public function testLoadClassMetadataReturnsThrowsInvalidMapping() {
    $loader = new YamlFileLoader(__DIR__ . '/../../Fixtures/invalid-mapping.yml');
    $loader
      ->loadClassMetadata($this->metadata);
  }
  public function testLoadClassMetadata() {
    $this->loader
      ->loadClassMetadata($this->metadata);
    $this
      ->assertEquals(TestClassMetadataFactory::createXmlCLassMetadata(), $this->metadata);
  }

}

Members