Create ShortUrlModeTest

This commit is contained in:
Alejandro Celaya 2023-01-29 11:32:13 +01:00
parent d847c7648e
commit 8afa582aa5

View file

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\Core\ShortUrl\Model;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode;
class ShortUrlModeTest extends TestCase
{
/**
* @test
* @dataProvider provideModes
*/
public function deprecatedValuesAreProperlyParsed(string $mode, ?ShortUrlMode $expected): void
{
self::assertSame($expected, ShortUrlMode::tryDeprecated($mode));
}
public function provideModes(): iterable
{
yield 'invalid' => ['invalid', null];
yield 'foo' => ['foo', null];
yield 'loose' => ['loose', ShortUrlMode::LOOSE];
yield 'loosely' => ['loosely', ShortUrlMode::LOOSE];
yield 'strict' => ['strict', ShortUrlMode::STRICT];
}
}