Skip to content

Commit

Permalink
Add tests for iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Aug 18, 2021
1 parent f21af33 commit fa402b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/Client/DefaultRegistrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public function register(iterable $strategyHandlers): bool
return true;
}
if (!is_array($strategyHandlers)) {
// @codeCoverageIgnoreStart
$strategyHandlers = iterator_to_array($strategyHandlers);
// @codeCoverageIgnoreEnd
}
$request = $this->requestFactory
->createRequest('POST', $this->configuration->getUrl() . 'client/register')
Expand Down
6 changes: 5 additions & 1 deletion tests/Client/DefaultRegistrationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unleash\Client\Tests\Client;

use ArrayIterator;
use GuzzleHttp\Psr7\HttpFactory;
use Unleash\Client\Client\DefaultRegistrationService;
use Unleash\Client\Configuration\UnleashConfiguration;
Expand All @@ -27,10 +28,13 @@ public function testRegister()
$configuration
);

$this->pushResponse([], 1, 202);
$this->pushResponse([], 2, 202);
self::assertTrue($instance->register([
new DefaultStrategyHandler(),
]));
self::assertTrue($instance->register(new ArrayIterator([
new DefaultStrategyHandler(),
])));

$this->pushResponse([
'type' => 'password',
Expand Down

0 comments on commit fa402b3

Please sign in to comment.