/** * @dataProvider getBuildPagerWithPage2Tests */ public function testBuildPagerWithPage2($page, $perPage) { $this->pager->expects($this->once())->method('setMaxPerPage')->with($this->equalTo('50'))->will($this->returnValue(null)); $this->pager->expects($this->once())->method('setPage')->with($this->equalTo('3'))->will($this->returnValue(null)); $this->datagrid = new Datagrid($this->query, $this->columns, $this->pager, $this->formBuilder, array()); $this->datagrid->setValue('_per_page', null, $perPage); $this->datagrid->setValue('_page', null, $page); $this->datagrid->buildPager(); $this->assertSame(array('_per_page' => array('type' => null, 'value' => $perPage), '_page' => array('type' => null, 'value' => $page)), $this->datagrid->getValues()); $this->assertInstanceOf('Symfony\\Component\\Form\\FormBuilder', $this->formBuilder->get('_sort_by')); $this->assertInstanceOf('Symfony\\Component\\Form\\FormBuilder', $this->formBuilder->get('_sort_order')); $this->assertInstanceOf('Symfony\\Component\\Form\\FormBuilder', $this->formBuilder->get('_page')); $this->assertInstanceOf('Symfony\\Component\\Form\\FormBuilder', $this->formBuilder->get('_per_page')); }
public function testGetResults() { $this->assertEquals(null, $this->datagrid->getResults()); $this->pager->expects($this->once())->method('getResults')->will($this->returnValue(array('foo', 'bar'))); $this->assertEquals(array('foo', 'bar'), $this->datagrid->getResults()); }