Added option for enable/disable URL Validation by response status code.

This commit is contained in:
Mikolaj Gogula
2017-10-17 11:03:12 +02:00
parent 1009f9e7c6
commit 18d9815e88
6 changed files with 49 additions and 9 deletions

View File

@@ -58,7 +58,21 @@ class UrlShortenerTest extends TestCase
$this->cache = new ArrayCache();
$this->urlShortener = new UrlShortener($this->httpClient->reveal(), $this->em->reveal(), $this->cache);
$this->setUrlShortener(false);
}
/**
* @param bool $isUrlValidationExists
*/
public function setUrlShortener($isUrlValidationExists)
{
$this->urlShortener = new UrlShortener(
$this->httpClient->reveal(),
$this->em->reveal(),
$this->cache,
UrlShortener::DEFAULT_CHARS,
$isUrlValidationExists
);
}
/**
@@ -93,6 +107,8 @@ class UrlShortenerTest extends TestCase
*/
public function exceptionIsThrownWhenUrlDoesNotExist()
{
$this->setUrlShortener(true);
$this->httpClient->request(Argument::cetera())->willThrow(
new ClientException('', $this->prophesize(Request::class)->reveal())
);