Example #1
0
 /**
  * @covers Kunstmaan\NodeBundle\Entity\Node::addNodeTranslation
  * @covers Kunstmaan\NodeBundle\Entity\Node::getNodeTranslation
  */
 public function testGetNodeTranslation()
 {
     $translation1 = new NodeTranslation();
     $translation1->setLang('nl');
     $translation1->setOnline(true);
     $this->object->addNodeTranslation($translation1);
     $translation2 = new NodeTranslation();
     $translation2->setLang('fr');
     $translation2->setOnline(true);
     $this->object->addNodeTranslation($translation2);
     $this->assertEquals($translation1, $this->object->getNodeTranslation('nl'));
     $this->assertEquals($translation2, $this->object->getNodeTranslation('fr'));
     $this->assertNotEquals($translation1, $this->object->getNodeTranslation('fr'));
     $this->assertNotEquals($translation2, $this->object->getNodeTranslation('nl'));
     $this->assertNull($this->object->getNodeTranslation('en'));
 }
 /**
  * Add documents for the node translation (and children) to the index
  *
  * @param Node   $node
  * @param string $lang
  */
 public function createNodeDocuments(Node $node, $lang)
 {
     $nodeTranslation = $node->getNodeTranslation($lang);
     if ($nodeTranslation) {
         if ($this->indexNodeTranslation($nodeTranslation)) {
             $this->indexChildren($node, $lang);
         }
     }
 }