test: Align icingacli test commands with default settings
We cleaned the default settings for travis, the CLI commands now use the same default. The following issue should be fixed for issues: https://github.com/Icinga/icinga-packaging/issues/50
This commit is contained in:
parent
5ba3ff3c4d
commit
9921ebc2f8
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace Icinga\Module\Test\Clicommands;
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Cli\Command;
|
||||
|
||||
/**
|
||||
|
@ -10,18 +11,6 @@ use Icinga\Cli\Command;
|
|||
*/
|
||||
class PhpCommand extends Command
|
||||
{
|
||||
/**
|
||||
* Default arguments and options for PHP_CodeSniffer
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $phpcsDefaultParams = array(
|
||||
'-p',
|
||||
'--standard=PSR2',
|
||||
'--extensions=php',
|
||||
'--encoding=utf-8'
|
||||
);
|
||||
|
||||
/**
|
||||
* Run all unit-test suites
|
||||
*
|
||||
|
@ -42,6 +31,11 @@ class PhpCommand extends Command
|
|||
* icingacli test php unit --verbose
|
||||
* icingacli test php unit --build
|
||||
* icingacli test php unit --include=*SpecialTest
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* Default settings are defined via `modules/test/phpunit.xml` under icingaweb'
|
||||
* installation directory.
|
||||
*/
|
||||
public function unitAction()
|
||||
{
|
||||
|
@ -69,11 +63,12 @@ class PhpCommand extends Command
|
|||
$options[] = $include;
|
||||
}
|
||||
|
||||
chdir(realpath(__DIR__ . '/../..'));
|
||||
$command = $this->getEnvironmentVariables() . $phpUnit . ' ' . join(
|
||||
' ',
|
||||
array_merge($options, $this->params->getAllStandalone())
|
||||
);
|
||||
chdir(Icinga::app()->getBaseDir());
|
||||
$command = $this->getEnvironmentVariables()
|
||||
. $phpUnit
|
||||
. ' -c modules/test/phpunit.xml'
|
||||
. ' ' . join(' ', array_merge($options, $this->params->getAllStandalone()));
|
||||
|
||||
if ($this->isVerbose) {
|
||||
$res = `$command`;
|
||||
foreach (preg_split('/\n/', $res) as $line) {
|
||||
|
@ -114,6 +109,11 @@ class PhpCommand extends Command
|
|||
* icingacli test php style --build
|
||||
* icingacli test php style --include=path/to/your/file
|
||||
* icingacli test php style --exclude=*someFile* --exclude=someOtherFile*
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* Default rules are defined via `phpcs.xml` and `icingaweb2.ruleset.xml` in icingaweb'
|
||||
* installation directory.
|
||||
*/
|
||||
public function styleAction()
|
||||
{
|
||||
|
@ -141,20 +141,13 @@ class PhpCommand extends Command
|
|||
$arguments = array_filter(array_map(function ($p) {
|
||||
return realpath($p);
|
||||
}, $include));
|
||||
if (empty($arguments)) {
|
||||
$arguments = array(
|
||||
realpath(__DIR__ . '/../../../../application'),
|
||||
realpath(__DIR__ . '/../../../../library/Icinga')
|
||||
);
|
||||
}
|
||||
|
||||
chdir(realpath(__DIR__ . '/../..'));
|
||||
chdir(Icinga::app()->getBaseDir());
|
||||
passthru(
|
||||
$phpcs . ' ' . join(
|
||||
' ',
|
||||
array_merge(
|
||||
$options,
|
||||
$this->phpcsDefaultParams,
|
||||
$arguments,
|
||||
$this->params->getAllStandalone()
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue