mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 11:54:27 +02:00
Config: Improve the node.config.php transformation
- Add more types - Improvement for assoziative arrays and key-value arrays - Add a lot more tests
This commit is contained in:
parent
eda65296f5
commit
4c28f9cf9c
9 changed files with 301 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