mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Removed several deprecated components
This commit is contained in:
@@ -11,7 +11,7 @@ use function array_merge;
|
||||
|
||||
class SimplifiedConfigParserTest extends TestCase
|
||||
{
|
||||
private $postProcessor;
|
||||
private SimplifiedConfigParser $postProcessor;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
@@ -40,7 +40,7 @@ class SimplifiedConfigParserTest extends TestCase
|
||||
'short_domain_host' => 'doma.in',
|
||||
'validate_url' => false,
|
||||
'delete_short_url_threshold' => 50,
|
||||
'not_found_redirect_to' => 'foobar.com',
|
||||
'invalid_short_url_redirect_to' => 'foobar.com',
|
||||
'redis_servers' => [
|
||||
'tcp://1.1.1.1:1111',
|
||||
'tcp://1.2.2.2:2222',
|
||||
@@ -125,28 +125,4 @@ class SimplifiedConfigParserTest extends TestCase
|
||||
|
||||
$this->assertEquals(array_merge($expected, $simplified), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideConfigWithDeprecates
|
||||
*/
|
||||
public function properlyMapsDeprecatedConfigs(array $config, string $expected): void
|
||||
{
|
||||
$result = ($this->postProcessor)($config);
|
||||
$this->assertEquals($expected, $result['not_found_redirects']['invalid_short_url']);
|
||||
}
|
||||
|
||||
public function provideConfigWithDeprecates(): iterable
|
||||
{
|
||||
yield 'only deprecated config' => [['not_found_redirect_to' => 'old_value'], 'old_value'];
|
||||
yield 'only new config' => [['invalid_short_url_redirect_to' => 'new_value'], 'new_value'];
|
||||
yield 'both configs, new first' => [
|
||||
['invalid_short_url_redirect_to' => 'new_value', 'not_found_redirect_to' => 'old_value'],
|
||||
'new_value',
|
||||
];
|
||||
yield 'both configs, deprecated first' => [
|
||||
['not_found_redirect_to' => 'old_value', 'invalid_short_url_redirect_to' => 'new_value'],
|
||||
'new_value',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user