improved calendar (#784)
This commit is contained in:
@@ -34,10 +34,8 @@ class BashExecutor
|
||||
|
||||
$command = rtrim($this->rootDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($command, DIRECTORY_SEPARATOR);
|
||||
|
||||
ob_start();
|
||||
passthru($command, $exitCode);
|
||||
$result = ob_get_clean();
|
||||
|
||||
return new BashResult($exitCode, $result);
|
||||
return new BashResult($exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,13 @@ class BashResult
|
||||
* @var string
|
||||
*/
|
||||
protected $exitCode;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
* @param string $exitCode
|
||||
* @param string $result
|
||||
*/
|
||||
public function __construct($exitCode, $result)
|
||||
public function __construct($exitCode)
|
||||
{
|
||||
$this->exitCode = $exitCode;
|
||||
$this->result = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,34 +31,4 @@ class BashResult
|
||||
{
|
||||
return $this->exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $exitCode
|
||||
* @return BashResult
|
||||
*/
|
||||
public function setExitCode(string $exitCode)
|
||||
{
|
||||
$this->exitCode = $exitCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResult(): string
|
||||
{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $result
|
||||
* @return BashResult
|
||||
*/
|
||||
public function setResult(string $result)
|
||||
{
|
||||
$this->result = $result;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class RunCodestyleCommand extends Command
|
||||
->setName('kimai:codestyle')
|
||||
->setDescription('Check and fix the projects coding style')
|
||||
->addOption('fix', null, InputOption::VALUE_NONE, 'Fix all found problems')
|
||||
->addOption('checkstyle', null, InputOption::VALUE_OPTIONAL, '')
|
||||
;
|
||||
}
|
||||
|
||||
@@ -60,38 +59,17 @@ class RunCodestyleCommand extends Command
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$filename = null;
|
||||
|
||||
$args = [];
|
||||
if (!$input->getOption('fix')) {
|
||||
$filename = $input->getOption('checkstyle');
|
||||
$args[] = '--dry-run';
|
||||
$args[] = '--verbose';
|
||||
$args[] = '--show-progress=none';
|
||||
|
||||
if (!empty($filename) && (file_exists($filename) && !is_writeable($filename))) {
|
||||
$io->error('Target file is not writeable: ' . $filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($filename)) {
|
||||
$filename = $this->rootDir . '/' . $filename;
|
||||
$args[] = '> ' . $filename;
|
||||
} else {
|
||||
$args[] = '--format=txt';
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->executor->execute('/vendor/bin/php-cs-fixer fix ' . implode(' ', $args));
|
||||
|
||||
$io->write($result->getResult());
|
||||
|
||||
if ($result->getExitCode() > 0) {
|
||||
$io->error(
|
||||
'Found problems while checking your code styles' .
|
||||
(!empty($filename) ? '. Saved checkstyle data to: ' . $filename : '')
|
||||
);
|
||||
$io->error('Found violations while checking code styles');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ class RunIntegrationTestsCommand extends RunUnitTestsCommand
|
||||
*/
|
||||
protected function createPhpunitCmdLine()
|
||||
{
|
||||
return '/bin/phpunit --group integration ' . $this->rootDir . '/tests';
|
||||
return '/vendor/bin/phpunit --group integration ' . $this->rootDir . '/tests';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ class RunUnitTestsCommand extends Command
|
||||
|
||||
$result = $this->executor->execute($this->createPhpunitCmdLine());
|
||||
|
||||
$io->write($result->getResult());
|
||||
|
||||
if ($result->getExitCode() > 0) {
|
||||
$io->error('Found problems while running tests');
|
||||
|
||||
@@ -76,6 +74,6 @@ class RunUnitTestsCommand extends Command
|
||||
*/
|
||||
protected function createPhpunitCmdLine()
|
||||
{
|
||||
return '/bin/phpunit --exclude-group integration ' . $this->rootDir . '/tests';
|
||||
return '/vendor/bin/phpunit --exclude-group integration ' . $this->rootDir . '/tests';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user