/** * @expectedException InvalidArgumentException */ public function testValidateDataThrowsExceptionIfDataIsNotACollection() { $handler = new Handler($dataGrid = $this->getMockDataGrid()); $handler->validateData('test'); }
public function testMaxResults() { $dataGrid = m::mock('Cartalyst\\DataGrid\\DataGrid'); $dataGrid->shouldReceive('getData')->andReturn($this->getData()); $dataGrid->shouldReceive('getEnvironment')->andReturn($environment = m::mock('Cartalyst\\DataGrid\\Environment')); $environment->shouldReceive('getRequestProvider')->andReturn($requestProvider = m::mock('Cartalyst\\DataGrid\\RequestProviders\\ProviderInterface')); $requestProvider->shouldReceive('getFilters')->once()->andReturn(array()); $requestProvider->shouldReceive('getSort')->once()->andReturn('first_name'); $requestProvider->shouldReceive('getDirection')->once()->andReturn('asc'); $columns = array('first_name', 'gender' => 'sex', 'sortable', 'age'); $dataGrid->shouldReceive('getColumns')->andReturn($columns); $handler = new Handler($dataGrid); $handler->setUpDataHandlerContext(false, 1); $this->assertCount(1, $handler->getResults()); }