From 2290e37b9703ba0b64b53a71f1dc65d73475966f Mon Sep 17 00:00:00 2001 From: Christian Wahler Date: Mon, 3 Mar 2014 18:10:33 +0100 Subject: [PATCH 1/6] Use PHP 5.3 compatible array syntax --- PHPCI/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index 3f20c3ed..cc2cb885 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -24,7 +24,7 @@ class Application extends b8\Application { $request =& $this->request; $route = '/:controller/:action'; - $opts = ['controller' => 'Home', 'action' => 'index']; + $opts = array('controller' => 'Home', 'action' => 'index'); $this->router->clearRoutes(); $this->router->register($route, $opts, function (&$route, Response &$response) use (&$request) From 6a79bcea6099bd731270401fe097c2b3e2bd5662 Mon Sep 17 00:00:00 2001 From: OKINAKA Kenshin Date: Fri, 7 Mar 2014 11:06:17 +0900 Subject: [PATCH 2/6] Fix daemonise --- daemonise | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemonise b/daemonise index 45751190..5117e414 100755 --- a/daemonise +++ b/daemonise @@ -15,7 +15,7 @@ require('bootstrap.php'); use PHPCI\Command\DaemoniseCommand; use Symfony\Component\Console\Application; -$loggerConfig = \PHPCI\Helper\LoggerConfig::newFromFile(__DIR__ . "/loggerconfig.php"); +$loggerConfig = \PHPCI\Logging\LoggerConfig::newFromFile(__DIR__ . "/loggerconfig.php"); $application = new Application(); $application->add(new DaemoniseCommand($loggerConfig->getFor('DaemoniseCommand'))); From 1497f96b01fa5b985544db52a99fb070db8d0ca5 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 9 Mar 2014 00:30:00 +0700 Subject: [PATCH 3/6] Fixed findBinary function for windows (which -> where) --- PHPCI/Helper/CommandExecutor.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PHPCI/Helper/CommandExecutor.php b/PHPCI/Helper/CommandExecutor.php index 60061404..5c64dd45 100644 --- a/PHPCI/Helper/CommandExecutor.php +++ b/PHPCI/Helper/CommandExecutor.php @@ -118,11 +118,12 @@ class CommandExecutor return $this->rootDir . 'vendor/bin/' . $bin; } - // Use "which" - $which = trim(shell_exec('which ' . $bin)); + // Use "where" for windows and "which" for other OS + $findCmd = (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') ? 'which' : 'where'; + $findCmdResult = trim(shell_exec($findCmd . ' ' . $bin)); - if (!empty($which)) { - return $which; + if (!empty($findCmdResult)) { + return $findCmdResult; } } From 9c6073c495b22d6322bf3ef3c49d1cd27c9eeaf7 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 9 Mar 2014 00:30:32 +0700 Subject: [PATCH 4/6] Fixed composer plugin for using on Windows --- PHPCI/Plugin/Composer.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index 1af4abf6..0b89afe0 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -45,8 +45,11 @@ class Composer implements \PHPCI\Plugin $this->phpci->logFailure('Could not find Composer.'); return false; } - - $cmd = $composerLocation . ' --no-ansi --no-interaction '; + $cmd = ''; + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $cmd = 'php '; + } + $cmd .= $composerLocation . ' --no-ansi --no-interaction '; $cmd .= ($this->preferDist ? '--prefer-dist' : null) . ' --working-dir="%s" %s'; return $this->phpci->executeCommand($cmd, $this->directory, $this->action); From 7307866d24195c724ae3327b8f705d417df00fff Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 9 Mar 2014 01:44:54 +0700 Subject: [PATCH 5/6] Added phpunit config/bootstrap files for autostart all tests --- Tests/bootstrap.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ composer.json | 2 +- phpunit.xml | 24 ++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Tests/bootstrap.php create mode 100644 phpunit.xml diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100644 index 00000000..50b285c5 --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,44 @@ +loadYaml(dirname(__DIR__) . '/PHPCI/config.yml'); +} + +require_once(dirname(__DIR__) . '/vars.php'); diff --git a/composer.json b/composer.json index acafd3a5..7ccbc600 100644 --- a/composer.json +++ b/composer.json @@ -34,11 +34,11 @@ }, "require-dev": { + "phpunit/phpunit": "3.7.*", "phpspec/prophecy-phpunit": "1.*" }, "suggest": { - "phpunit/phpunit": "PHP unit testing framework", "phpmd/phpmd": "PHP Mess Detector", "sebastian/phpcpd": "PHP Copy/Paste Detector", "squizlabs/php_codesniffer": "PHP Code Sniffer", diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000..15bd43aa --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,24 @@ + + + + + + ./Tests/PHPCI/Helper + + + ./Tests/PHPCI/Logging + + + ./Tests/PHPCI/Plugin + + + From 4c3645dbf29978dad80d154420d0b5392478a802 Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 9 Mar 2014 01:46:03 +0700 Subject: [PATCH 6/6] Fixed unittests on windows --- PHPCI/Helper/CommandExecutor.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PHPCI/Helper/CommandExecutor.php b/PHPCI/Helper/CommandExecutor.php index 5c64dd45..9b7fe442 100644 --- a/PHPCI/Helper/CommandExecutor.php +++ b/PHPCI/Helper/CommandExecutor.php @@ -75,6 +75,10 @@ class CommandExecutor $status = 0; exec($command, $this->lastOutput, $status); + foreach ($this->lastOutput as &$lastOutput) { + $lastOutput = trim($lastOutput, '"'); + } + if (!empty($this->lastOutput) && ($this->verbose|| $status != 0)) { $this->logger->log($this->lastOutput); }