getFields() public method

If null is returned every field should be contained.
public getFields ( ) : array | null
return array | null
Esempio n. 1
0
 /**
  * @dataProvider dataFieldsProvider
  */
 public function testGetFields($request)
 {
     $helper = new ListRestHelper($request, $this->em);
     $this->assertEquals(explode(',', $request->get('fields')), $helper->getFields());
     $this->assertEquals($request->get('sortBy'), $helper->getSortColumn());
     $this->assertEquals($request->get('sortOrder', 'asc'), $helper->getSortOrder());
     $this->assertEquals($request->get('search'), $helper->getSearchPattern());
     $this->assertEquals(explode(',', $request->get('searchFields')), $helper->getSearchFields());
     $this->assertEquals($request->get('limit'), $helper->getLimit());
     $this->assertEquals($request->get('limit') * ($request->get('page') - 1), $helper->getOffset());
 }
Esempio n. 2
0
 public function testGetFields()
 {
     $request = new Request(['fields' => 'field1,field2,field3', 'sortBy' => 'id', 'sortOrder' => 'desc', 'search' => 'test', 'searchFields' => 'title', 'limit' => 10, 'page' => 3]);
     $helper = new ListRestHelper($request, $this->em);
     $this->assertEquals(['field1', 'field2', 'field3'], $helper->getFields());
     $this->assertEquals('id', $helper->getSortColumn());
     $this->assertEquals('desc', $helper->getSortOrder());
     $this->assertEquals('test', $helper->getSearchPattern());
     $this->assertEquals(['title'], $helper->getSearchFields());
     $this->assertEquals(10, $helper->getLimit());
     $this->assertEquals(20, $helper->getOffset());
 }