/**
  * @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'));
 }
 /**
  * @param string $lang   The locale
  * @param string $title  The title
  * @param string $slug   The slug
  * @param int    $nodeId The node id
  *
  * @return Node
  */
 private function getNodeWithTranslation($lang, $title, $slug, $nodeId = null)
 {
     $node = new Node();
     if (!is_null($nodeId)) {
         $node->setId($nodeId);
     }
     $nodeTranslation = new NodeTranslation();
     $nodeTranslation->setLang($lang)->setTitle($title)->setSlug($slug);
     $node->addNodeTranslation($nodeTranslation);
     return $node;
 }
 /**
  * @covers Kunstmaan\NodeBundle\Helper\Menu\ActionsMenuBuilder::createActionsMenu
  */
 public function testShouldShowRecopyButtonWhenTheNodeHasTranslations()
 {
     $node = new Node();
     $nodeTranslation = new NodeTranslation();
     $nodeTranslation->setLang('en');
     $node->addNodeTranslation($nodeTranslation);
     $nodeVersion = new NodeVersion();
     $nodeVersion->setType("public");
     $nodeVersion->setNodeTranslation($nodeTranslation);
     $this->builder->setActiveNodeVersion($nodeVersion);
     $nodeTranslation = new NodeTranslation();
     $nodeTranslation->setLang('nl');
     $node->addNodeTranslation($nodeTranslation);
     $nodeVersion = new NodeVersion();
     $nodeVersion->setType("public");
     $nodeVersion->setNodeTranslation($nodeTranslation);
     $this->builder->setActiveNodeVersion($nodeVersion);
     $menu = $this->builder->createActionsMenu();
     $this->assertNotNull($menu->getChild('action.recopyfromlanguage'));
     $this->assertEquals('page-main-actions js-auto-collapse-buttons', $menu->getChildrenAttribute('class'));
 }