diff --git a/tests/TestCase/Shell/Helper/ProgressHelperTest.php b/tests/TestCase/Shell/Helper/ProgressHelperTest.php index 0ddbc9e46a1..85c624cb550 100644 --- a/tests/TestCase/Shell/Helper/ProgressHelperTest.php +++ b/tests/TestCase/Shell/Helper/ProgressHelperTest.php @@ -75,6 +75,36 @@ public function testOutputSuccess() $this->assertEquals($expected, $this->stub->messages()); } + /** + * Test output with options + * + * @return void + */ + public function testOutputSuccessOptions() + { + $this->helper->output([ + 'total' => 10, + 'width' => 20, + 'callback' => function ($progress) { + $progress->increment(2); + } + ]); + $expected = [ + '', + '==> 20%', + '', + '=====> 40%', + '', + '========> 60%', + '', + '===========> 80%', + '', + '==============> 100%', + '', + ]; + $this->assertEquals($expected, $this->stub->messages()); + } + /** * Test using the helper manually. * @@ -132,4 +162,33 @@ public function testIncrementWithNegatives() ]; $this->assertEquals($expected, $this->stub->messages()); } + + /** + * Test increment and draw with options + * + * @return void + */ + public function testIncrementWithOptions() + { + $this->helper->init([ + 'total' => 10, + 'width' => 20, + ]); + $expected = [ + '', + '=====> 40%', + '', + '===========> 80%', + '', + '==============> 100%', + ]; + $this->helper->increment(4); + $this->helper->draw(); + $this->helper->increment(4); + $this->helper->draw(); + $this->helper->increment(4); + $this->helper->draw(); + + $this->assertEquals($expected, $this->stub->messages()); + } }