diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-09 14:47:28 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-01-14 15:02:55 +0100 |
commit | f2cb03e1553e50a7aa93197ba2c9805681d3d768 (patch) | |
tree | 780164e1c4ea30ea949a28bf4f30ff61ed9fdb8c /tests | |
parent | a06f0256a9ce0f928b6b658b1df92bafbf6b6086 (diff) | |
download | nextcloud-server-f2cb03e1553e50a7aa93197ba2c9805681d3d768.tar.gz nextcloud-server-f2cb03e1553e50a7aa93197ba2c9805681d3d768.zip |
Allow array recursion in get
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/command/config/system/getconfigtest.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/core/command/config/system/getconfigtest.php b/tests/core/command/config/system/getconfigtest.php index 54dcdd434ab..ebbea634cde 100644 --- a/tests/core/command/config/system/getconfigtest.php +++ b/tests/core/command/config/system/getconfigtest.php @@ -90,13 +90,19 @@ class GetConfigTest extends TestCase { ['name', ['a' => 1, 'b' => 2], true, null, false, 'json', 0, json_encode(['a' => 1, 'b' => 2])], ['name', ['a' => 1, 'b' => 2], true, null, false, 'plain', 0, "a: 1\nb: 2"], + // Nested depth + [['name', 'a'], ['a' => 1, 'b' => 2], true, null, false, 'json', 0, json_encode(1)], + [['name', 'a'], ['a' => 1, 'b' => 2], true, null, false, 'plain', 0, '1'], + [['name', 'c'], ['a' => 1, 'b' => 2], true, true, true, 'json', 0, json_encode(true)], + [['name', 'c'], ['a' => 1, 'b' => 2], true, true, false, 'json', 1, null], + ]; } /** * @dataProvider getData * - * @param string $configName + * @param string[] $configNames * @param mixed $value * @param bool $configExists * @param mixed $defaultValue @@ -105,7 +111,13 @@ class GetConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testGet($configName, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) { + public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) { + if (is_array($configNames)) { + $configName = $configNames[0]; + } else { + $configName = $configNames; + $configNames = [$configName]; + } $this->systemConfig->expects($this->atLeastOnce()) ->method('getKeys') ->willReturn($configExists ? [$configName] : []); @@ -122,7 +134,7 @@ class GetConfigTest extends TestCase { $this->consoleInput->expects($this->once()) ->method('getArgument') ->with('name') - ->willReturn($configName); + ->willReturn($configNames); $this->consoleInput->expects($this->any()) ->method('getOption') ->willReturnMap([ |