Skip to content

Commit bdc1052

Browse files
committed
Reorganize some code
1 parent 2544aac commit bdc1052

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ composer.lock
33
/vendor
44
/docs
55
/coverage.xml
6+
/coverage

src/Phug/DevTool/Command/CheckCommand.php

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ protected function configure()
2222
->setHelp('Runs all necessary checks');
2323
}
2424

25+
protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)
26+
{
27+
$app = $this->getApplication();
28+
29+
if (($code = $app->runCommand('coverage:check', $output, [
30+
'input-file' => $coverageFilePath,
31+
])) !== 0) {
32+
return $code;
33+
}
34+
35+
if ($input->getOption('report') && ($code = $app->runCommand('coverage:report', $output, [
36+
'input-file' => $coverageFilePath,
37+
'--php-version', '5.6',
38+
])) !== 0) {
39+
return $code;
40+
}
41+
42+
return 0;
43+
}
44+
2545
protected function execute(InputInterface $input, OutputInterface $output)
2646
{
2747
$app = $this->getApplication();
@@ -49,21 +69,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
4969
return $code;
5070
}
5171

52-
if (!$app->isHhvm()) {
53-
if (($code = $app->runCommand('coverage:check', $output, [
54-
'input-file' => $coverageFilePath,
55-
])) !== 0) {
56-
return $code;
57-
}
58-
59-
if ($input->getOption('report')) {
60-
if (($code = $app->runCommand('coverage:report', $output, [
61-
'input-file' => $coverageFilePath,
62-
'--php-version', '5.6',
63-
])) !== 0) {
64-
return $code;
65-
}
66-
}
72+
if (!$app->isHhvm() && ($code = $this->runCoverage($input, $output, $coverageFilePath))) {
73+
return $code;
6774
}
6875

6976
if (version_compare(PHP_VERSION, '5.6.0') >= 0 && ($code = $app->runCommand('code-style:check', $output, [

tests/Phug/DevTool/Command/CheckCommandTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testConfigure()
2525
}
2626

2727
/**
28+
* @covers ::runCoverage
2829
* @covers ::execute
2930
*/
3031
public function testExecute()

0 commit comments

Comments
 (0)