/**
  * @return TaxonomyMetadata
  */
 public function getMetadata()
 {
     if ($this->metadata === null) {
         $this->metadata = $this->metadataFactory->getMetadata($this->em);
     }
     return $this->metadata;
 }
 /**
  * @dataProvider dataTestVocabularyMetadataProvider
  */
 public function testVocabularyMetadata($class, $expectations)
 {
     $factory = new MetadataFactory();
     $metadata = $factory->getMetadata($this->_em);
     if ($expectations['exists'] === true) {
         $this->assertTrue($metadata->hasEntityMetadata($class));
         $entityMetadata = $metadata->getEntityMetadata($class);
         $vocabularies = $entityMetadata->getVocabularies();
         $this->assertCount(count($expectations['vocabularies']), $vocabularies);
         foreach ($expectations['vocabularies'] as $name => $expectedVoc) {
             $vocab = $entityMetadata->getVocabularyByName($name);
             $this->assertNotNull($vocab);
             $this->assertTrue($vocab->isSingular() === $expectedVoc['singular']);
             $this->assertEquals($expectedVoc['property'], $vocab->getPropertyName());
         }
         foreach ($expectations['non_vocabularies'] as $nonVocab) {
             $this->assertNull($entityMetadata->getVocabularyByName($nonVocab));
         }
     } else {
         $this->assertFalse($metadata->hasEntityMetadata($class));
     }
 }