Exemplo n.º 1
0
 public function testAddVote()
 {
     $voteValue = 1;
     $vote = $this->getMock('FOS\\CommentBundle\\Model\\VoteInterface');
     $comment = $this->getMock('FOS\\CommentBundle\\Model\\VotableCommentInterface');
     $vote->expects($this->once())->method('setComment')->with($comment);
     $vote->expects($this->once())->method('getValue')->will($this->returnValue($voteValue));
     $comment->expects($this->once())->method('incrementScore')->with($voteValue);
     $this->em->expects($this->exactly(2))->method('persist');
     $this->em->expects($this->once())->method('flush');
     $manager = new VoteManager($this->em, $this->class);
     $manager->addVote($vote, $comment);
 }