|
7 | 7 |
|
8 | 8 | namespace Tests\Core\Command\Config\System; |
9 | 9 |
|
| 10 | +use OC\Core\Command\Config\System\CastHelper; |
10 | 11 | use OC\Core\Command\Config\System\SetConfig; |
11 | 12 | use OC\SystemConfig; |
12 | 13 | use Symfony\Component\Console\Input\InputInterface; |
@@ -35,7 +36,7 @@ protected function setUp(): void { |
35 | 36 | $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); |
36 | 37 |
|
37 | 38 | /** @var \OC\SystemConfig $systemConfig */ |
38 | | - $this->command = new SetConfig($systemConfig); |
| 39 | + $this->command = new SetConfig($systemConfig, new CastHelper()); |
39 | 40 | } |
40 | 41 |
|
41 | 42 |
|
@@ -112,53 +113,4 @@ public function testSetUpdateOnly($configNames, $existingData): void { |
112 | 113 |
|
113 | 114 | $this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); |
114 | 115 | } |
115 | | - |
116 | | - public static function castValueProvider(): array { |
117 | | - return [ |
118 | | - [null, 'string', ['value' => '', 'readable-value' => 'empty string']], |
119 | | - |
120 | | - ['abc', 'string', ['value' => 'abc', 'readable-value' => 'string abc']], |
121 | | - |
122 | | - ['123', 'integer', ['value' => 123, 'readable-value' => 'integer 123']], |
123 | | - ['456', 'int', ['value' => 456, 'readable-value' => 'integer 456']], |
124 | | - |
125 | | - ['2.25', 'double', ['value' => 2.25, 'readable-value' => 'double 2.25']], |
126 | | - ['0.5', 'float', ['value' => 0.5, 'readable-value' => 'double 0.5']], |
127 | | - |
128 | | - ['', 'null', ['value' => null, 'readable-value' => 'null']], |
129 | | - |
130 | | - ['true', 'boolean', ['value' => true, 'readable-value' => 'boolean true']], |
131 | | - ['false', 'bool', ['value' => false, 'readable-value' => 'boolean false']], |
132 | | - ]; |
133 | | - } |
134 | | - |
135 | | - /** |
136 | | - * @dataProvider castValueProvider |
137 | | - */ |
138 | | - public function testCastValue($value, $type, $expectedValue): void { |
139 | | - $this->assertSame($expectedValue, |
140 | | - $this->invokePrivate($this->command, 'castValue', [$value, $type]) |
141 | | - ); |
142 | | - } |
143 | | - |
144 | | - public static function castValueInvalidProvider(): array { |
145 | | - return [ |
146 | | - ['123', 'foobar'], |
147 | | - |
148 | | - [null, 'integer'], |
149 | | - ['abc', 'integer'], |
150 | | - ['76ggg', 'double'], |
151 | | - ['true', 'float'], |
152 | | - ['foobar', 'boolean'], |
153 | | - ]; |
154 | | - } |
155 | | - |
156 | | - /** |
157 | | - * @dataProvider castValueInvalidProvider |
158 | | - */ |
159 | | - public function testCastValueInvalid($value, $type): void { |
160 | | - $this->expectException(\InvalidArgumentException::class); |
161 | | - |
162 | | - $this->invokePrivate($this->command, 'castValue', [$value, $type]); |
163 | | - } |
164 | 116 | } |
0 commit comments