public function testRequestProviderIsAbleToBeOverridden() { $environment = new Environment($requestProvider = m::mock('Cartalyst\\DataGrid\\RequestProviders\\ProviderInterface')); $this->assertEquals($requestProvider, $environment->getRequestProvider()); $environment->setRequestProvider($requestProvider2 = m::mock('Cartalyst\\DataGrid\\RequestProviders\\ProviderInterface')); $this->assertEquals($requestProvider2, $environment->getRequestProvider()); $this->assertNotSame($requestProvider, $environment->getRequestProvider()); }
/** * Returns the active request instance. * * @return \Cartalyst\DataGrid\RequestProviders\ProviderInterface * @static */ public static function getRequestProvider() { return \Cartalyst\DataGrid\Environment::getRequestProvider(); }
/** * Returns the instance as an array. * * @return array */ public function toArray() { $handler = $this->dataHandler; $requestProvider = $this->env->getRequestProvider(); return array('total' => $handler->getTotalCount(), 'filtered' => $handler->getFilteredCount(), 'throttle' => $requestProvider->getThrottle(), 'threshold' => $requestProvider->getThreshold(), 'page' => $handler->getPage(), 'pages' => $handler->getPagesCount(), 'previous_page' => $handler->getPreviousPage(), 'next_page' => $handler->getNextPage(), 'per_page' => $handler->getPerPage(), 'sort' => $handler->getSort(), 'direction' => $handler->getDirection(), 'default_column' => $handler->getDefaultColumn(), 'results' => $handler->getResults()); }