/**
  * @param $config
  * @param $data
  * @param $includes
  * @param $request
  * @return array
  */
 private function transformResult($config, $data, $includes, $request)
 {
     if ($config['list']) {
         return $this->transformer->transformList($config['transform'], $data, $includes, $this->buildPaginatorAdapter($data, $request));
     }
     return $this->transformer->transform($config['transform'], $data, $includes);
 }
 public function testTransformPaginatedObjectCollectionReturnsCorrectArray()
 {
     $collection = array(new \stdClass());
     $pager = new Pagerfanta(new MockPager($collection));
     $pagerAdapter = new PagerfantaPaginatorAdapter($pager, function () {
         return 'url';
     });
     $registry = new TransformerRegistry();
     $transformer = new ArrayTransformer(new Manager(), $registry);
     $registry->setTransformer('mock', new MockTransformer());
     $data = $transformer->transformList('mock', array(new \stdClass()), array('child'), $pagerAdapter);
     $this->assertEquals(array('data' => array(array('transformed' => true, 'child' => array('data' => array('transformed' => true)))), 'meta' => array('pagination' => array('total' => 1, 'count' => 1, 'per_page' => $pager->getMaxPerPage(), 'current_page' => 1, 'total_pages' => 1, 'links' => array()))), $data);
 }