From a6450b00b75d1e3070147e3d6c81cd993e4943a0 Mon Sep 17 00:00:00 2001 From: Yves P Date: Mon, 8 Feb 2016 13:40:24 +0100 Subject: [PATCH] Make sure the line that will be overwritten in the CLI ProgressHelper does not have a new line feed Otherwise, it is impossible to be sure that the line that will be overwritten can be without any visual glitch. Before this change, visual glitch appeared when using Putty on Windows. --- src/Shell/Helper/ProgressHelper.php | 2 ++ tests/TestCase/Shell/Helper/ProgressHelperTest.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Shell/Helper/ProgressHelper.php b/src/Shell/Helper/ProgressHelper.php index 9397d7bc6f7..470985f97a0 100644 --- a/src/Shell/Helper/ProgressHelper.php +++ b/src/Shell/Helper/ProgressHelper.php @@ -69,6 +69,8 @@ public function output($args) $this->init($args); $callback = $args['callback']; + + $this->_io->out('', 0); while ($this->_progress < $this->_total) { $callback($this); $this->draw(); diff --git a/tests/TestCase/Shell/Helper/ProgressHelperTest.php b/tests/TestCase/Shell/Helper/ProgressHelperTest.php index afcc06111ac..5778888d09d 100644 --- a/tests/TestCase/Shell/Helper/ProgressHelperTest.php +++ b/tests/TestCase/Shell/Helper/ProgressHelperTest.php @@ -60,6 +60,7 @@ public function testOutputSuccess() $progress->increment(20); }]); $expected = [ + '', '', '==============> 20%', '', @@ -90,6 +91,7 @@ public function testOutputSuccessOptions() } ]); $expected = [ + '', '', '==> 20%', '',