Example #1
0
 public function getPaginator($name, array $args = [], array $config = [])
 {
     $config += $this->api->getPaginatorConfig($name);
     if ($config['output_token'] && $config['input_token']) {
         return new ResultPaginator($this, $name, $args, $config);
     }
     throw new UnexpectedValueException("Results for the {$name} operation of {$this->api['serviceFullName']} cannot be paginated.");
 }
 public function testCanRetrievePaginationConfig()
 {
     $expected = ['input_token' => 'a', 'output_token' => 'b', 'limit_key' => 'c', 'result_key' => 'd', 'more_results' => 'e'];
     // Stub out the API provider
     $service = new Service(function () use($expected) {
         return ['pagination' => ['foo' => $expected]];
     }, '', '');
     $actual = $service->getPaginatorConfig('foo');
     $this->assertSame($expected, $actual);
 }