Skip to content

Commit 2544aac

Browse files
committed
Simplify syntax
1 parent 9d5094d commit 2544aac

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

.codeclimate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ ratings:
2626
- "**.rb"
2727
exclude_paths:
2828
- config/
29+
- tests/

src/Phug/DevTool/Command/CheckCommand.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
3232
'--coverage-clover' => $coverageFilePath,
3333
];
3434

35-
if ($input->getOption('coverage-text')) {
36-
$args[] = '--coverage-text';
37-
}
38-
39-
if ($path = $input->getOption('coverage-clover')) {
40-
$args['--coverage-clover'] = $path;
41-
}
42-
43-
if ($path = $input->getOption('coverage-html')) {
44-
$args['--coverage-html'] = $path;
45-
}
35+
$passTrough = [
36+
'coverage-text',
37+
'coverage-clover',
38+
'coverage-html',
39+
'group',
40+
];
4641

47-
if ($group = $input->getOption('group')) {
48-
$args['--group'] = $group;
42+
foreach ($passTrough as $option) {
43+
if ($value = $input->getOption($option)) {
44+
$args[$option] = $value;
45+
}
4946
}
5047

5148
if (($code = $app->runCommand('unit-tests:run', $output, $args)) !== 0) {

tests/Phug/DevTool/Command/UnitTestsRunCommandTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ public function testExecute()
5050
}
5151
$coverageHtml = $app.DIRECTORY_SEPARATOR.'coverage';
5252
$coverageClover = $app.DIRECTORY_SEPARATOR.'coverage.xml';
53-
$coverageHtmlShellArg = escapeshellarg(addslashes($coverageHtml));
54-
$coverageCloverShellArg = escapeshellarg(addslashes($coverageClover));
5553
$input = new StringInput(
5654
'unit-tests:run'.
5755
' --coverage-text'.
58-
' --coverage-html='.$coverageHtmlShellArg.
59-
' --coverage-clover='.$coverageCloverShellArg
56+
' --coverage-html='.escapeshellarg(addslashes($coverageHtml)).
57+
' --coverage-clover='.escapeshellarg(addslashes($coverageClover))
6058
);
6159
$buffer = new NullOutput();
6260
$app = new Application();

0 commit comments

Comments
 (0)