From 6418fde928e853dd1642902649e7697eceba31ab Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Wed, 27 Apr 2016 15:20:20 +0100 Subject: [PATCH 1/2] Defaulting to using neither --prefer-source or --prefer-dist for composer. Allow user to specify either. --- .phpci.yml | 1 - PHPCI/Plugin/Composer.php | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.phpci.yml b/.phpci.yml index b4fd52ec..d6ea0921 100644 --- a/.phpci.yml +++ b/.phpci.yml @@ -13,7 +13,6 @@ build_settings: setup: composer: action: "install" - prefer_dist: false test: php_parallel_lint: diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index bd5f6658..7bd86ac3 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -61,6 +61,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $this->directory = $path; $this->action = 'install'; $this->preferDist = false; + $this->preferSource = false; $this->nodev = false; if (array_key_exists('directory', $options)) { @@ -75,6 +76,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $this->preferDist = (bool)$options['prefer_dist']; } + if (array_key_exists('prefer_source', $options)) { + $this->preferDist = false; + $this->preferSource = (bool)$options['prefer_source']; + } + if (array_key_exists('no_dev', $options)) { $this->nodev = (bool)$options['no_dev']; } @@ -97,10 +103,12 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin if ($this->preferDist) { $this->phpci->log('Using --prefer-dist flag'); - $cmd .= '--prefer-dist'; - } else { + $cmd .= ' --prefer-dist'; + } + + if ($this->preferSource) { $this->phpci->log('Using --prefer-source flag'); - $cmd .= '--prefer-source'; + $cmd .= ' --prefer-source'; } if ($this->nodev) { From 21ba39e6ff3d1e10b292799df9aa9375873cd349 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Wed, 27 Apr 2016 15:27:27 +0100 Subject: [PATCH 2/2] Fixes --- PHPCI/Helper/BaseCommandExecutor.php | 6 +----- PHPCI/Logging/BuildLogger.php | 4 +++- PHPCI/Plugin/Util/TestResultParsers/Codeception.php | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/PHPCI/Helper/BaseCommandExecutor.php b/PHPCI/Helper/BaseCommandExecutor.php index ddfa78df..b3b47f7b 100644 --- a/PHPCI/Helper/BaseCommandExecutor.php +++ b/PHPCI/Helper/BaseCommandExecutor.php @@ -76,6 +76,7 @@ abstract class BaseCommandExecutor implements CommandExecutor $this->lastOutput = array(); $command = call_user_func_array('sprintf', $args); + $this->logger->logDebug($command); if ($this->quiet) { $this->logger->log('Executing: ' . $command); @@ -89,11 +90,6 @@ abstract class BaseCommandExecutor implements CommandExecutor ); $pipes = array(); - - if (defined('PHPCI_DEBUG_MODE')) { - $this->logger->logDebug($command); - } - $process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null); if (is_resource($process)) { diff --git a/PHPCI/Logging/BuildLogger.php b/PHPCI/Logging/BuildLogger.php index cae5ff22..a68e9e6d 100644 --- a/PHPCI/Logging/BuildLogger.php +++ b/PHPCI/Logging/BuildLogger.php @@ -104,7 +104,9 @@ class BuildLogger implements LoggerAwareInterface */ public function logDebug($message) { - $this->log("\033[0;33m" . $message . "\033[0m"); + if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) { + $this->log("\033[0;33m" . $message . "\033[0m"); + } } /** diff --git a/PHPCI/Plugin/Util/TestResultParsers/Codeception.php b/PHPCI/Plugin/Util/TestResultParsers/Codeception.php index 39f28666..24af62e4 100644 --- a/PHPCI/Plugin/Util/TestResultParsers/Codeception.php +++ b/PHPCI/Plugin/Util/TestResultParsers/Codeception.php @@ -30,7 +30,6 @@ class Codeception implements ParserInterface { $this->phpci = $phpci; $this->resultsXml = $resultsXml; - $this->totalTests = 0; } @@ -71,7 +70,7 @@ class Codeception implements ParserInterface if (isset($testcase->failure) || isset($testcase->error)) { $testresult['pass'] = false; - $testresult['message'] = isset($testcase->failure) ? (string) $testcase->failure : (string) $testcase->error; + $testresult['message'] = (string)$testcase->failure . (string)$testcase->error; } else { $testresult['pass'] = true; }