Skip to content

Commit

Permalink
Merge pull request #770 from jeskew/fix-iterator-without-token
Browse files Browse the repository at this point in the history
Fix iterator without token
  • Loading branch information
jeskew committed Sep 18, 2015
2 parents f09d297 + a6bde53 commit a415f98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AwsClient.php
Expand Up @@ -245,7 +245,7 @@ public function getIterator($name, array $args = [])
return $this->getPaginator($name, $args)->search($key);
}

$result = $this->getCommand($name, $args)->search($key);
$result = $this->execute($this->getCommand($name, $args))->search($key);

return new \ArrayIterator((array) $result);
}
Expand Down
14 changes: 14 additions & 0 deletions tests/AwsClientTest.php
Expand Up @@ -141,6 +141,20 @@ public function testCanGetIterator()
);
}

public function testCanGetIteratorWithoutDefinedPaginator()
{
$client = $this->getTestClient('ec2');
$data = ['foo', 'bar', 'baz'];
$this->addMockResults($client, [new Result([
'Subnets' => [$data],
])]);
$iterator = $client->getIterator('DescribeSubnets');
$this->assertInstanceOf('Traversable', $iterator);
foreach ($iterator as $iterated) {
$this->assertSame($data, $iterated);
}
}

/**
* @expectedException \UnexpectedValueException
*/
Expand Down

0 comments on commit a415f98

Please sign in to comment.