示例#1
0
 /**
  * Test load.
  */
 public function testLoad()
 {
     $this->commentRepository->expects($this->any())->method('getAllCommentsSortedByParentAndIdAsc')->with($this->equalTo('source'))->will($this->returnValue($this->getCommentsStructure()));
     $comments = $this->commentCache->load('source', 'context');
     $this->assertEquals([['entity' => ['id' => 1, 'authorName' => 'Marc Morera', 'authorEmail' => '*****@*****.**', 'context' => 'admin', 'content' => 'comment1', 'nbVotes' => 2, 'nbUpVotes' => 1, 'nbDownVotes' => 1, 'createdAt' => '2015-01-01 00:00:00', 'updatedAt' => '2015-01-01 00:00:00'], 'children' => [['entity' => ['id' => 2, 'authorName' => 'Marc Morera', 'authorEmail' => '*****@*****.**', 'context' => 'admin', 'content' => 'comment2', 'nbVotes' => 2, 'nbUpVotes' => 1, 'nbDownVotes' => 1, 'createdAt' => '2015-01-01 00:00:00', 'updatedAt' => '2015-01-01 00:00:00'], 'children' => []], ['entity' => ['id' => 3, 'authorName' => 'Another guy', 'authorEmail' => '*****@*****.**', 'context' => 'admin', 'content' => 'comment3', 'nbVotes' => 2, 'nbUpVotes' => 1, 'nbDownVotes' => 1, 'createdAt' => '2015-01-01 00:00:00', 'updatedAt' => '2015-01-01 00:00:00'], 'children' => []]]], ['entity' => ['id' => 4, 'authorName' => 'Marc Morera', 'authorEmail' => '*****@*****.**', 'context' => 'admin', 'content' => 'comment4', 'nbVotes' => 2, 'nbUpVotes' => 1, 'nbDownVotes' => 1, 'createdAt' => '2015-01-01 00:00:00', 'updatedAt' => '2015-01-01 00:00:00'], 'children' => [['entity' => ['id' => 5, 'authorName' => 'Marc Morera', 'authorEmail' => '*****@*****.**', 'context' => 'admin', 'content' => 'comment5', 'nbVotes' => 2, 'nbUpVotes' => 1, 'nbDownVotes' => 1, 'createdAt' => '2015-01-01 00:00:00', 'updatedAt' => '2015-01-01 00:00:00'], 'children' => []]]]], $comments);
 }