mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 12:04:26 +02:00
Merge pull request #12674 from nupplaphil/bug/config_typesafe
Config: Improve the node.config.php transformation
This commit is contained in:
commit
21f172c585
9 changed files with 311 additions and 43 deletions
|
@ -36,8 +36,25 @@ class ConfigFileTransformerTest extends MockedTest
|
|||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/B.node.config.php'),
|
||||
],
|
||||
'friendica.local' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/C.node.config.php'),
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/C.node.config.php'),
|
||||
],
|
||||
'friendica.local.2' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/D.node.config.php'),
|
||||
],
|
||||
'object_invalid' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/object.node.config.php'),
|
||||
'assertException' => true,
|
||||
],
|
||||
'ressource_invalid' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/ressource.node.config.php'),
|
||||
'assertException' => true,
|
||||
],
|
||||
'test_types' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/types.node.config.php'),
|
||||
],
|
||||
'small_types' => [
|
||||
'configFile' => (dirname(__DIR__, 4) . '/datasets/config/transformer/small_types.node.config.php'),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -46,10 +63,14 @@ class ConfigFileTransformerTest extends MockedTest
|
|||
*
|
||||
* @dataProvider dataTests
|
||||
*/
|
||||
public function testConfigFile(string $configFile)
|
||||
public function testConfigFile(string $configFile, bool $assertException = false)
|
||||
{
|
||||
$dataArray = include $configFile;
|
||||
|
||||
if ($assertException) {
|
||||
self::expectException(\InvalidArgumentException::class);
|
||||
}
|
||||
|
||||
$newConfig = ConfigFileTransformer::encode($dataArray);
|
||||
|
||||
self::assertEquals(file_get_contents($configFile), $newConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue