/**
  * @expectedException \Exception
  */
 public function testInjectionWithMissingRelations()
 {
     $post = new Post();
     $post->setTitle('Foo');
     $post->setBody('Bar');
     $post->setSlug('foo-2');
     $this->_em->persist($post);
     $this->_em->flush();
     $webDev = $this->service->findTermByName('web_dev');
     $entityTerm = new EntityTerm();
     $entityTerm->setEntity($webDev);
     $this->_em->persist($entityTerm);
     $this->_em->flush();
 }
 public function testPlural()
 {
     $userRoleRepo = $this->_em->getRepository('Test:UserRole');
     $userRole = $userRoleRepo->findOneBy(array('id' => 1));
     $roles = $userRole->getRoles();
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\VocabularyFieldInterface', $roles);
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\PluralVocabularyField', $roles);
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\VocabularyInterface', $roles->getVocabulary());
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Tests\\Fixtures\\ORM\\Vocabulary', $roles->getVocabulary());
     $this->assertCount(2, $roles);
     $userRole = $userRoleRepo->findOneBy(array('id' => 2));
     foreach ($roles as $role) {
         $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\TermInterface', $role);
         $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Tests\\Fixtures\\ORM\\Term', $role);
     }
     $this->assertEquals(array($this->service->findTermByName('user'), $this->service->findTermByName('mod')), $roles->toArray());
     $roles = $userRole->getRoles();
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\VocabularyFieldInterface', $roles);
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\PluralVocabularyField', $roles);
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Entity\\VocabularyInterface', $roles->getVocabulary());
     $this->assertInstanceOf('ActiveLAMP\\Taxonomy\\Tests\\Fixtures\\ORM\\Vocabulary', $roles->getVocabulary());
     $this->assertCount(1, $roles);
     $this->assertEquals(array($this->service->findTermByName('super_admin')), $roles->toArray());
 }