/**
  * tests getId()
  */
 public function testGetIdShouldBeEqualSetId()
 {
     $this->textnode->setId('testid');
     $this->assertEquals('testid', $this->textnode->getId());
 }
 /**
  * Tests the action of reading a textnode without an active
  *     user session.
  */
 public function testReadTextnodeWithoutLogin()
 {
     $container = $this->getMock("Symfony\\Component\\DependencyInjection\\ContainerInterface");
     $mongo = $this->getMockBuilder("Doctrine\\Bundle\\MongoDBBundle\\ManagerRegistry")->disableOriginalConstructor()->getMock();
     $repository = $this->getMockBuilder("Doctrine\\ODM\\MongoDB\\DocumentRepository")->disableOriginalConstructor()->getMock();
     $authorizationChecker = $this->getMockBuilder('foobar')->setMethods(array('isGranted'))->getMock();
     $tokenStorage = $this->getMockBuilder("Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorage")->disableOriginalConstructor()->getMock();
     $template = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface');
     $container->expects($this->at(0))->method("get")->with($this->equalTo('doctrine_mongodb'))->will($this->returnValue($mongo));
     $mongo->expects($this->once())->method("getRepository")->with($this->equalTo('DembeloMain:Textnode'))->will($this->returnValue($repository));
     $hitch = array();
     $hitch['textnodeId'] = "55f5ab3708985c4b188b4578";
     $hitch['description'] = "Continue.";
     $hitch['status'] = Textnode::HITCH_STATUS_ACTIVE;
     $textnodeId = "55f5ab3708985c4b188b4577";
     $textnode = new Textnode();
     $textnode->setId($textnodeId);
     $textnode->setStatus(Textnode::STATUS_ACTIVE);
     $textnode->setText("Lorem ipsum dolor sit amet.");
     $textnode->appendHitch($hitch);
     $repository->expects($this->once())->method("findBy")->with(array('id' => new \MongoId($textnodeId), 'status' => Textnode::STATUS_ACTIVE))->will($this->returnValue(array($textnode)));
     $container->expects($this->at(1))->method("get")->with($this->equalTo('security.authorization_checker'))->will($this->returnValue($authorizationChecker));
     $container->expects($this->at(2))->method("get")->with($this->equalTo('security.token_storage'))->will($this->returnValue($tokenStorage));
     $authorizationChecker->expects($this->once())->method('isGranted')->with($this->equalTo('ROLE_USER'))->will($this->returnValue(false));
     $container->expects($this->at(3))->method("get")->with("templating")->will($this->returnValue($template));
     $template->expects($this->once())->method("renderResponse")->with("default/read.html.twig", array("textnode" => $textnode))->will($this->returnValue('renderresponse'));
     $controller = new DefaultController();
     $controller->setContainer($container);
     $result = $controller->readTextnodeAction($textnodeId);
     $this->assertEquals('renderresponse', $result);
 }