Ejemplo n.º 1
0
 /**
  * get document list
  *
  * @param array $wheres 검색 조건
  * @param array $orders 정렬 조건
  * @param int   $limit  get document count
  * @return array
  */
 public function gets(array $wheres, array $orders, $limit = null)
 {
     $items = [];
     foreach ($this->document->gets($wheres, $orders, $limit) as $doc) {
         $items[] = $this->makeItem($doc);
     }
     $this->shortIdGenerator->associates($items);
     $this->slug->associates($items);
     return $items;
 }
 /**
  * test get documents
  *
  * @return void
  */
 public function testGets()
 {
     $conn = $this->conn;
     $repo = $this->repo;
     $configHandler = $this->configHandler;
     $instanceManager = $this->instanceManager;
     $request = $this->request;
     $handler = new DocumentHandler($conn, $repo, $configHandler, $instanceManager, $request);
     $ids = ['id1', 'id2'];
     $instanceId = 'instanceId';
     $userId = 'userId';
     $repo->shouldReceive('fetch')->andReturn([['id' => $ids[0], 'instanceId' => $instanceId, 'userId' => $userId], ['id' => $ids[1], 'instanceId' => $instanceId, 'userId' => $userId]]);
     $wheres = ['instanceId' => $instanceId];
     $orders = [];
     $configHandler->shouldReceive('get')->andReturn($this->getConfigEntity());
     $result = $handler->gets($wheres, $orders);
     $this->assertEquals(2, count($result));
     $this->assertInstanceOf('Xpressengine\\Document\\DocumentEntity', $result[0]);
 }