示例#1
0
 /**
  * get revision list by document id
  *
  * @param string $id document id
  * @return array
  */
 public function getRevisions($id)
 {
     return $this->document->getRevisions($id);
 }
 /**
  * test get revisions by document id
  *
  * @return void
  */
 public function testGetRevisions()
 {
     $conn = $this->conn;
     $repo = $this->repo;
     $configHandler = $this->configHandler;
     $instanceManager = $this->instanceManager;
     $request = $this->request;
     $handler = new DocumentHandler($conn, $repo, $configHandler, $instanceManager, $request);
     $instanceId = 'instanceId';
     $id = 'documentId';
     $userId = 'userId';
     $configHandler->shouldReceive('get')->andReturn($this->getConfigEntity());
     $repo->shouldReceive('findById')->andReturn(['id' => $id, 'instanceId' => $instanceId, 'userId' => $userId]);
     $repo->shouldReceive('getsRevision')->andReturn([['id' => 'documentId', 'revisionId' => 'rid1'], ['id' => 'documentId', 'revisionId' => 'rid2']]);
     $result = $handler->getRevisions('revisionId');
     $this->assertInstanceOf('Xpressengine\\Document\\DocumentEntity', $result[0]);
 }