Removed several deprecated components

This commit is contained in:
Alejandro Celaya
2019-12-31 15:38:37 +01:00
parent 78b484e657
commit 434b56fa8c
41 changed files with 16 additions and 952 deletions

View File

@@ -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',
];
}
}