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;
|
namespace Icinga\Module\Test\Clicommands;
|
||||||
|
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Cli\Command;
|
use Icinga\Cli\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,18 +11,6 @@ use Icinga\Cli\Command;
|
||||||
*/
|
*/
|
||||||
class PhpCommand extends 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
|
* Run all unit-test suites
|
||||||
*
|
*
|
||||||
|
@ -42,6 +31,11 @@ class PhpCommand extends Command
|
||||||
* icingacli test php unit --verbose
|
* icingacli test php unit --verbose
|
||||||
* icingacli test php unit --build
|
* icingacli test php unit --build
|
||||||
* icingacli test php unit --include=*SpecialTest
|
* icingacli test php unit --include=*SpecialTest
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
*
|
||||||
|
* Default settings are defined via `modules/test/phpunit.xml` under icingaweb'
|
||||||
|
* installation directory.
|
||||||
*/
|
*/
|
||||||
public function unitAction()
|
public function unitAction()
|
||||||
{
|
{
|
||||||
|
@ -69,11 +63,12 @@ class PhpCommand extends Command
|
||||||
$options[] = $include;
|
$options[] = $include;
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir(realpath(__DIR__ . '/../..'));
|
chdir(Icinga::app()->getBaseDir());
|
||||||
$command = $this->getEnvironmentVariables() . $phpUnit . ' ' . join(
|
$command = $this->getEnvironmentVariables()
|
||||||
' ',
|
. $phpUnit
|
||||||
array_merge($options, $this->params->getAllStandalone())
|
. ' -c modules/test/phpunit.xml'
|
||||||
);
|
. ' ' . join(' ', array_merge($options, $this->params->getAllStandalone()));
|
||||||
|
|
||||||
if ($this->isVerbose) {
|
if ($this->isVerbose) {
|
||||||
$res = `$command`;
|
$res = `$command`;
|
||||||
foreach (preg_split('/\n/', $res) as $line) {
|
foreach (preg_split('/\n/', $res) as $line) {
|
||||||
|
@ -114,6 +109,11 @@ class PhpCommand extends Command
|
||||||
* icingacli test php style --build
|
* icingacli test php style --build
|
||||||
* icingacli test php style --include=path/to/your/file
|
* icingacli test php style --include=path/to/your/file
|
||||||
* icingacli test php style --exclude=*someFile* --exclude=someOtherFile*
|
* 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()
|
public function styleAction()
|
||||||
{
|
{
|
||||||
|
@ -141,20 +141,13 @@ class PhpCommand extends Command
|
||||||
$arguments = array_filter(array_map(function ($p) {
|
$arguments = array_filter(array_map(function ($p) {
|
||||||
return realpath($p);
|
return realpath($p);
|
||||||
}, $include));
|
}, $include));
|
||||||
if (empty($arguments)) {
|
|
||||||
$arguments = array(
|
|
||||||
realpath(__DIR__ . '/../../../../application'),
|
|
||||||
realpath(__DIR__ . '/../../../../library/Icinga')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir(realpath(__DIR__ . '/../..'));
|
chdir(Icinga::app()->getBaseDir());
|
||||||
passthru(
|
passthru(
|
||||||
$phpcs . ' ' . join(
|
$phpcs . ' ' . join(
|
||||||
' ',
|
' ',
|
||||||
array_merge(
|
array_merge(
|
||||||
$options,
|
$options,
|
||||||
$this->phpcsDefaultParams,
|
|
||||||
$arguments,
|
$arguments,
|
||||||
$this->params->getAllStandalone()
|
$this->params->getAllStandalone()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue