mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 17:23:12 +08:00
Created persistence for device long URLs
This commit is contained in:
@@ -7,7 +7,6 @@ namespace ShlinkioTest\Shlink\Core\Config;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||
|
||||
use function Functional\map;
|
||||
use function putenv;
|
||||
|
||||
class EnvVarsTest extends TestCase
|
||||
@@ -59,11 +58,4 @@ class EnvVarsTest extends TestCase
|
||||
yield 'DB_DRIVER without default' => [EnvVars::DB_DRIVER, null, null];
|
||||
yield 'DB_DRIVER with default' => [EnvVars::DB_DRIVER, 'foobar', 'foobar'];
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function allValuesCanBeListed(): void
|
||||
{
|
||||
$expected = map(EnvVars::cases(), static fn (EnvVars $envVar) => $envVar->value);
|
||||
self::assertEquals(EnvVars::values(), $expected);
|
||||
}
|
||||
}
|
||||
|
||||
43
module/Core/test/Functions/FunctionsTest.php
Normal file
43
module/Core/test/Functions/FunctionsTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Core\Functions;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||
use Shlinkio\Shlink\Core\Model\DeviceType;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Model\OrderableField;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitType;
|
||||
|
||||
use function Functional\map;
|
||||
use function Shlinkio\Shlink\Core\enumValues;
|
||||
|
||||
class FunctionsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideEnums
|
||||
*/
|
||||
public function enumValuesReturnsExpectedValueForEnum(string $enum, array $expectedValues): void
|
||||
{
|
||||
self::assertEquals($expectedValues, enumValues($enum));
|
||||
}
|
||||
|
||||
public function provideEnums(): iterable
|
||||
{
|
||||
yield EnvVars::class => [EnvVars::class, map(EnvVars::cases(), static fn (EnvVars $envVar) => $envVar->value)];
|
||||
yield VisitType::class => [
|
||||
VisitType::class,
|
||||
map(VisitType::cases(), static fn (VisitType $envVar) => $envVar->value),
|
||||
];
|
||||
yield DeviceType::class => [
|
||||
DeviceType::class,
|
||||
map(DeviceType::cases(), static fn (DeviceType $envVar) => $envVar->value),
|
||||
];
|
||||
yield OrderableField::class => [
|
||||
OrderableField::class,
|
||||
map(OrderableField::cases(), static fn (OrderableField $envVar) => $envVar->value),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user