public function testGetFirstRequest()
 {
     $client = RestClient::create();
     $config = $this->getConfig();
     $scroller = new ResponseParamScroller(['responseParam' => '_scroll_id', 'queryParam' => 'scroll_id', 'includeParams' => false, 'scrollRequest' => ['endpoint' => '_search/scroll', 'method' => 'POST', 'params' => ['scroll' => '1m']]]);
     $expected = $client->createRequest($config->getConfig());
     self::assertEquals($expected, $scroller->getFirstRequest($client, $config));
 }
Esempio n. 2
0
 protected static function createScroller(array $config)
 {
     if (empty($config['method'])) {
         return NoScroller::create([]);
     }
     switch ($config['method']) {
         case 'offset':
             return OffsetScroller::create($config);
         case 'response.param':
             return ResponseParamScroller::create($config);
         case 'response.url':
             return ResponseUrlScroller::create($config);
         case 'zendesk.response.url':
             return ZendeskResponseUrlScroller::create($config);
         case 'facebook.response.url':
             return FacebookResponseUrlScroller::create($config);
         case 'pagenum':
             return PageScroller::create($config);
         case 'cursor':
             return CursorScroller::create($config);
         case 'multiple':
             return MultipleScroller::create($config);
         default:
             $method = is_string($config['method']) ? $config['method'] : json_encode($config['method']);
             throw new UserException("Unknown pagination method '{$method}'");
             break;
     }
 }