/**
  * @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();
 }
 /**
  * @param ObjectManager $manager
  */
 protected function loadPosts(ObjectManager $manager)
 {
     $software = $this->getReference('term-software');
     $post = new Post();
     $post->setBody('Test.');
     $post->setTitle('Hello, world!');
     $post->setSlug('hello-world');
     $manager->persist($post);
     $manager->flush();
     $entityTerm = new EntityTerm();
     $entityTerm->setEntityType(get_class($post));
     $entityTerm->setEntityIdentifier($post->getId());
     $entityTerm->setTerm($software);
     $manager->persist($entityTerm);
     $manager->flush();
     $post = new Post();
     $post->setBody('Test.');
     $post->setTitle('Test article');
     $post->setSlug('test123');
     $manager->persist($post);
     $manager->flush();
 }