Completed
Push — master ( abced2...d161e0 )
by Maxence
34:21 queued 29s
created
tests/Core/Command/Config/ListConfigsTest.php 1 patch
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -17,311 +17,311 @@
 block discarded – undo
17 17
 use Test\TestCase;
18 18
 
19 19
 class ListConfigsTest extends TestCase {
20
-	/** @var \PHPUnit\Framework\MockObject\MockObject */
21
-	protected $appConfig;
22
-	/** @var \PHPUnit\Framework\MockObject\MockObject */
23
-	protected $systemConfig;
24
-	/** @var \PHPUnit\Framework\MockObject\MockObject */
25
-	protected $configManager;
20
+    /** @var \PHPUnit\Framework\MockObject\MockObject */
21
+    protected $appConfig;
22
+    /** @var \PHPUnit\Framework\MockObject\MockObject */
23
+    protected $systemConfig;
24
+    /** @var \PHPUnit\Framework\MockObject\MockObject */
25
+    protected $configManager;
26 26
 
27
-	/** @var \PHPUnit\Framework\MockObject\MockObject */
28
-	protected $consoleInput;
29
-	/** @var \PHPUnit\Framework\MockObject\MockObject */
30
-	protected $consoleOutput;
27
+    /** @var \PHPUnit\Framework\MockObject\MockObject */
28
+    protected $consoleInput;
29
+    /** @var \PHPUnit\Framework\MockObject\MockObject */
30
+    protected $consoleOutput;
31 31
 
32
-	/** @var \Symfony\Component\Console\Command\Command */
33
-	protected $command;
32
+    /** @var \Symfony\Component\Console\Command\Command */
33
+    protected $command;
34 34
 
35
-	protected function setUp(): void {
36
-		parent::setUp();
35
+    protected function setUp(): void {
36
+        parent::setUp();
37 37
 
38
-		$systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
39
-			->disableOriginalConstructor()
40
-			->getMock();
41
-		$appConfig = $this->appConfig = $this->getMockBuilder(IAppConfig::class)
42
-			->disableOriginalConstructor()
43
-			->getMock();
44
-		$configManager = $this->configManager = $this->getMockBuilder(ConfigManager::class)
45
-			->disableOriginalConstructor()
46
-			->getMock();
38
+        $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
39
+            ->disableOriginalConstructor()
40
+            ->getMock();
41
+        $appConfig = $this->appConfig = $this->getMockBuilder(IAppConfig::class)
42
+            ->disableOriginalConstructor()
43
+            ->getMock();
44
+        $configManager = $this->configManager = $this->getMockBuilder(ConfigManager::class)
45
+            ->disableOriginalConstructor()
46
+            ->getMock();
47 47
 
48
-		$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
49
-		$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
48
+        $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
49
+        $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
50 50
 
51
-		/** @var \OC\SystemConfig $systemConfig */
52
-		/** @var \OCP\IAppConfig $appConfig */
53
-		/** @var ConfigManager $configManager */
54
-		$this->command = new ListConfigs($systemConfig, $appConfig, $configManager);
55
-	}
51
+        /** @var \OC\SystemConfig $systemConfig */
52
+        /** @var \OCP\IAppConfig $appConfig */
53
+        /** @var ConfigManager $configManager */
54
+        $this->command = new ListConfigs($systemConfig, $appConfig, $configManager);
55
+    }
56 56
 
57
-	public static function listData(): array {
58
-		return [
59
-			[
60
-				'all',
61
-				// config.php
62
-				[
63
-					'secret',
64
-					'overwrite.cli.url',
65
-				],
66
-				[
67
-					['secret', 'N;', IConfig::SENSITIVE_VALUE],
68
-					['overwrite.cli.url', 'N;', 'http://localhost'],
69
-				],
70
-				// app config
71
-				[
72
-					['files', false, [
73
-						'enabled' => 'yes',
74
-					]],
75
-					['core', false, [
76
-						'global_cache_gc_lastrun' => '1430388388',
77
-					]],
78
-				],
79
-				false,
80
-				json_encode([
81
-					'system' => [
82
-						'secret' => IConfig::SENSITIVE_VALUE,
83
-						'overwrite.cli.url' => 'http://localhost',
84
-					],
85
-					'apps' => [
86
-						'core' => [
87
-							'global_cache_gc_lastrun' => '1430388388',
88
-						],
89
-						'files' => [
90
-							'enabled' => 'yes',
91
-						],
92
-					],
93
-				]),
94
-			],
95
-			[
96
-				'all',
97
-				// config.php
98
-				[
99
-					'secret',
100
-					'overwrite.cli.url',
101
-				],
102
-				[
103
-					['secret', 'N;', 'my secret'],
104
-					['overwrite.cli.url', 'N;', 'http://localhost'],
105
-				],
106
-				// app config
107
-				[
108
-					['files', false, [
109
-						'enabled' => 'yes',
110
-					]],
111
-					['core', false, [
112
-						'global_cache_gc_lastrun' => '1430388388',
113
-					]],
114
-				],
115
-				true,
116
-				json_encode([
117
-					'system' => [
118
-						'secret' => 'my secret',
119
-						'overwrite.cli.url' => 'http://localhost',
120
-					],
121
-					'apps' => [
122
-						'core' => [
123
-							'global_cache_gc_lastrun' => '1430388388',
124
-						],
125
-						'files' => [
126
-							'enabled' => 'yes',
127
-						],
128
-					],
129
-				]),
130
-			],
131
-			[
132
-				'system',
133
-				// config.php
134
-				[
135
-					'secret',
136
-					'objectstore',
137
-					'overwrite.cli.url',
138
-				],
139
-				[
140
-					['secret', 'N;', IConfig::SENSITIVE_VALUE],
141
-					['objectstore', 'N;', [
142
-						'class' => 'OC\\Files\\ObjectStore\\Swift',
143
-						'arguments' => [
144
-							'username' => 'facebook100000123456789',
145
-							'password' => IConfig::SENSITIVE_VALUE,
146
-						],
147
-					]],
148
-					['overwrite.cli.url', 'N;', 'http://localhost'],
149
-				],
150
-				// app config
151
-				[
152
-					['files', false, [
153
-						'enabled' => 'yes',
154
-					]],
155
-					['core', false, [
156
-						'global_cache_gc_lastrun' => '1430388388',
157
-					]],
158
-				],
159
-				false,
160
-				json_encode([
161
-					'system' => [
162
-						'secret' => IConfig::SENSITIVE_VALUE,
163
-						'objectstore' => [
164
-							'class' => 'OC\\Files\\ObjectStore\\Swift',
165
-							'arguments' => [
166
-								'username' => 'facebook100000123456789',
167
-								'password' => IConfig::SENSITIVE_VALUE,
168
-							],
169
-						],
170
-						'overwrite.cli.url' => 'http://localhost',
171
-					],
172
-				]),
173
-			],
174
-			[
175
-				'system',
176
-				// config.php
177
-				[
178
-					'secret',
179
-					'overwrite.cli.url',
180
-				],
181
-				[
182
-					['secret', 'N;', 'my secret'],
183
-					['overwrite.cli.url', 'N;', 'http://localhost'],
184
-				],
185
-				// app config
186
-				[
187
-					['files', false, [
188
-						'enabled' => 'yes',
189
-					]],
190
-					['core', false, [
191
-						'global_cache_gc_lastrun' => '1430388388',
192
-					]],
193
-				],
194
-				true,
195
-				json_encode([
196
-					'system' => [
197
-						'secret' => 'my secret',
198
-						'overwrite.cli.url' => 'http://localhost',
199
-					],
200
-				]),
201
-			],
202
-			[
203
-				'files',
204
-				// config.php
205
-				[
206
-					'secret',
207
-					'overwrite.cli.url',
208
-				],
209
-				[
210
-					['secret', 'N;', 'my secret'],
211
-					['overwrite.cli.url', 'N;', 'http://localhost'],
212
-				],
213
-				// app config
214
-				[
215
-					['files', false, [
216
-						'enabled' => 'yes',
217
-					]],
218
-					['core', false, [
219
-						'global_cache_gc_lastrun' => '1430388388',
220
-					]],
221
-				],
222
-				false,
223
-				json_encode([
224
-					'apps' => [
225
-						'files' => [
226
-							'enabled' => 'yes',
227
-						],
228
-					],
229
-				]),
230
-			],
231
-			[
232
-				'files',
233
-				// config.php
234
-				[
235
-					'secret',
236
-					'overwrite.cli.url',
237
-				],
238
-				[
239
-					['secret', 'N;', 'my secret'],
240
-					['overwrite.cli.url', 'N;', 'http://localhost'],
241
-				],
242
-				// app config
243
-				[
244
-					['files', false, [
245
-						'enabled' => 'yes',
246
-					]],
247
-					['core', false, [
248
-						'global_cache_gc_lastrun' => '1430388388',
249
-					]],
250
-				],
251
-				true,
252
-				json_encode([
253
-					'apps' => [
254
-						'files' => [
255
-							'enabled' => 'yes',
256
-						],
257
-					],
258
-				]),
259
-			],
260
-		];
261
-	}
57
+    public static function listData(): array {
58
+        return [
59
+            [
60
+                'all',
61
+                // config.php
62
+                [
63
+                    'secret',
64
+                    'overwrite.cli.url',
65
+                ],
66
+                [
67
+                    ['secret', 'N;', IConfig::SENSITIVE_VALUE],
68
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
69
+                ],
70
+                // app config
71
+                [
72
+                    ['files', false, [
73
+                        'enabled' => 'yes',
74
+                    ]],
75
+                    ['core', false, [
76
+                        'global_cache_gc_lastrun' => '1430388388',
77
+                    ]],
78
+                ],
79
+                false,
80
+                json_encode([
81
+                    'system' => [
82
+                        'secret' => IConfig::SENSITIVE_VALUE,
83
+                        'overwrite.cli.url' => 'http://localhost',
84
+                    ],
85
+                    'apps' => [
86
+                        'core' => [
87
+                            'global_cache_gc_lastrun' => '1430388388',
88
+                        ],
89
+                        'files' => [
90
+                            'enabled' => 'yes',
91
+                        ],
92
+                    ],
93
+                ]),
94
+            ],
95
+            [
96
+                'all',
97
+                // config.php
98
+                [
99
+                    'secret',
100
+                    'overwrite.cli.url',
101
+                ],
102
+                [
103
+                    ['secret', 'N;', 'my secret'],
104
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
105
+                ],
106
+                // app config
107
+                [
108
+                    ['files', false, [
109
+                        'enabled' => 'yes',
110
+                    ]],
111
+                    ['core', false, [
112
+                        'global_cache_gc_lastrun' => '1430388388',
113
+                    ]],
114
+                ],
115
+                true,
116
+                json_encode([
117
+                    'system' => [
118
+                        'secret' => 'my secret',
119
+                        'overwrite.cli.url' => 'http://localhost',
120
+                    ],
121
+                    'apps' => [
122
+                        'core' => [
123
+                            'global_cache_gc_lastrun' => '1430388388',
124
+                        ],
125
+                        'files' => [
126
+                            'enabled' => 'yes',
127
+                        ],
128
+                    ],
129
+                ]),
130
+            ],
131
+            [
132
+                'system',
133
+                // config.php
134
+                [
135
+                    'secret',
136
+                    'objectstore',
137
+                    'overwrite.cli.url',
138
+                ],
139
+                [
140
+                    ['secret', 'N;', IConfig::SENSITIVE_VALUE],
141
+                    ['objectstore', 'N;', [
142
+                        'class' => 'OC\\Files\\ObjectStore\\Swift',
143
+                        'arguments' => [
144
+                            'username' => 'facebook100000123456789',
145
+                            'password' => IConfig::SENSITIVE_VALUE,
146
+                        ],
147
+                    ]],
148
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
149
+                ],
150
+                // app config
151
+                [
152
+                    ['files', false, [
153
+                        'enabled' => 'yes',
154
+                    ]],
155
+                    ['core', false, [
156
+                        'global_cache_gc_lastrun' => '1430388388',
157
+                    ]],
158
+                ],
159
+                false,
160
+                json_encode([
161
+                    'system' => [
162
+                        'secret' => IConfig::SENSITIVE_VALUE,
163
+                        'objectstore' => [
164
+                            'class' => 'OC\\Files\\ObjectStore\\Swift',
165
+                            'arguments' => [
166
+                                'username' => 'facebook100000123456789',
167
+                                'password' => IConfig::SENSITIVE_VALUE,
168
+                            ],
169
+                        ],
170
+                        'overwrite.cli.url' => 'http://localhost',
171
+                    ],
172
+                ]),
173
+            ],
174
+            [
175
+                'system',
176
+                // config.php
177
+                [
178
+                    'secret',
179
+                    'overwrite.cli.url',
180
+                ],
181
+                [
182
+                    ['secret', 'N;', 'my secret'],
183
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
184
+                ],
185
+                // app config
186
+                [
187
+                    ['files', false, [
188
+                        'enabled' => 'yes',
189
+                    ]],
190
+                    ['core', false, [
191
+                        'global_cache_gc_lastrun' => '1430388388',
192
+                    ]],
193
+                ],
194
+                true,
195
+                json_encode([
196
+                    'system' => [
197
+                        'secret' => 'my secret',
198
+                        'overwrite.cli.url' => 'http://localhost',
199
+                    ],
200
+                ]),
201
+            ],
202
+            [
203
+                'files',
204
+                // config.php
205
+                [
206
+                    'secret',
207
+                    'overwrite.cli.url',
208
+                ],
209
+                [
210
+                    ['secret', 'N;', 'my secret'],
211
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
212
+                ],
213
+                // app config
214
+                [
215
+                    ['files', false, [
216
+                        'enabled' => 'yes',
217
+                    ]],
218
+                    ['core', false, [
219
+                        'global_cache_gc_lastrun' => '1430388388',
220
+                    ]],
221
+                ],
222
+                false,
223
+                json_encode([
224
+                    'apps' => [
225
+                        'files' => [
226
+                            'enabled' => 'yes',
227
+                        ],
228
+                    ],
229
+                ]),
230
+            ],
231
+            [
232
+                'files',
233
+                // config.php
234
+                [
235
+                    'secret',
236
+                    'overwrite.cli.url',
237
+                ],
238
+                [
239
+                    ['secret', 'N;', 'my secret'],
240
+                    ['overwrite.cli.url', 'N;', 'http://localhost'],
241
+                ],
242
+                // app config
243
+                [
244
+                    ['files', false, [
245
+                        'enabled' => 'yes',
246
+                    ]],
247
+                    ['core', false, [
248
+                        'global_cache_gc_lastrun' => '1430388388',
249
+                    ]],
250
+                ],
251
+                true,
252
+                json_encode([
253
+                    'apps' => [
254
+                        'files' => [
255
+                            'enabled' => 'yes',
256
+                        ],
257
+                    ],
258
+                ]),
259
+            ],
260
+        ];
261
+    }
262 262
 
263
-	/**
264
-	 * @dataProvider listData
265
-	 *
266
-	 * @param string $app
267
-	 * @param array $systemConfigs
268
-	 * @param array $systemConfigMap
269
-	 * @param array $appConfig
270
-	 * @param bool $private
271
-	 * @param string $expected
272
-	 */
273
-	public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected): void {
274
-		$this->systemConfig->expects($this->any())
275
-			->method('getKeys')
276
-			->willReturn($systemConfigs);
277
-		if ($private) {
278
-			$this->systemConfig->expects($this->any())
279
-				->method('getValue')
280
-				->willReturnMap($systemConfigMap);
281
-			$this->appConfig->expects($this->any())
282
-				->method('getValues')
283
-				->willReturnMap($appConfig);
284
-		} else {
285
-			$this->systemConfig->expects($this->any())
286
-				->method('getFilteredValue')
287
-				->willReturnMap($systemConfigMap);
288
-			$this->appConfig->expects($this->any())
289
-				->method('getFilteredValues')
290
-				->willReturnMap($appConfig);
291
-		}
263
+    /**
264
+     * @dataProvider listData
265
+     *
266
+     * @param string $app
267
+     * @param array $systemConfigs
268
+     * @param array $systemConfigMap
269
+     * @param array $appConfig
270
+     * @param bool $private
271
+     * @param string $expected
272
+     */
273
+    public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected): void {
274
+        $this->systemConfig->expects($this->any())
275
+            ->method('getKeys')
276
+            ->willReturn($systemConfigs);
277
+        if ($private) {
278
+            $this->systemConfig->expects($this->any())
279
+                ->method('getValue')
280
+                ->willReturnMap($systemConfigMap);
281
+            $this->appConfig->expects($this->any())
282
+                ->method('getValues')
283
+                ->willReturnMap($appConfig);
284
+        } else {
285
+            $this->systemConfig->expects($this->any())
286
+                ->method('getFilteredValue')
287
+                ->willReturnMap($systemConfigMap);
288
+            $this->appConfig->expects($this->any())
289
+                ->method('getFilteredValues')
290
+                ->willReturnMap($appConfig);
291
+        }
292 292
 
293
-		$this->appConfig->expects($this->any())
294
-			->method('getApps')
295
-			->willReturn(['core', 'files']);
296
-		$this->appConfig->expects($this->any())
297
-			->method('getValues')
298
-			->willReturnMap($appConfig);
293
+        $this->appConfig->expects($this->any())
294
+            ->method('getApps')
295
+            ->willReturn(['core', 'files']);
296
+        $this->appConfig->expects($this->any())
297
+            ->method('getValues')
298
+            ->willReturnMap($appConfig);
299 299
 
300
-		$this->consoleInput->expects($this->once())
301
-			->method('getArgument')
302
-			->with('app')
303
-			->willReturn($app);
300
+        $this->consoleInput->expects($this->once())
301
+            ->method('getArgument')
302
+            ->with('app')
303
+            ->willReturn($app);
304 304
 
305
-		$this->consoleInput->expects($this->any())
306
-			->method('getOption')
307
-			->willReturnMap([
308
-				['output', 'json'],
309
-				['private', $private],
310
-			]);
305
+        $this->consoleInput->expects($this->any())
306
+            ->method('getOption')
307
+            ->willReturnMap([
308
+                ['output', 'json'],
309
+                ['private', $private],
310
+            ]);
311 311
 
312
-		global $output;
312
+        global $output;
313 313
 
314
-		$output = '';
315
-		$this->consoleOutput->expects($this->any())
316
-			->method('writeln')
317
-			->willReturnCallback(function ($value) {
318
-				global $output;
319
-				$output .= $value . "\n";
320
-				return $output;
321
-			});
314
+        $output = '';
315
+        $this->consoleOutput->expects($this->any())
316
+            ->method('writeln')
317
+            ->willReturnCallback(function ($value) {
318
+                global $output;
319
+                $output .= $value . "\n";
320
+                return $output;
321
+            });
322 322
 
323
-		$this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
323
+        $this->invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
324 324
 
325
-		$this->assertEquals($expected, trim($output, "\n"));
326
-	}
325
+        $this->assertEquals($expected, trim($output, "\n"));
326
+    }
327 327
 }
Please login to merge, or discard this patch.