mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Added option for enable/disable URL Validation by response status code.
This commit is contained in:
@@ -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())
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user