mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Increased MSI to 65%
This commit is contained in:
33
module/Core/test/Exception/InvalidUrlExceptionTest.php
Normal file
33
module/Core/test/Exception/InvalidUrlExceptionTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Core\Exception;
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||
use Throwable;
|
||||
|
||||
class InvalidUrlExceptionTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider providePrevious
|
||||
*/
|
||||
public function properlyCreatesExceptionFromUrl(?Throwable $prev)
|
||||
{
|
||||
$e = InvalidUrlException::fromUrl('http://the_url.com', $prev);
|
||||
|
||||
$this->assertEquals('Provided URL "http://the_url.com" is not an existing and valid URL', $e->getMessage());
|
||||
$this->assertEquals($prev !== null ? $prev->getCode() : -1, $e->getCode());
|
||||
$this->assertEquals($prev, $e->getPrevious());
|
||||
}
|
||||
|
||||
public function providePrevious(): array
|
||||
{
|
||||
return [
|
||||
[null],
|
||||
[new Exception('Previos error', 10)],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user