public function testShortBarColorRed() { $expected = "\r[31m▓░░░░ 20.0% (2/10)[39m"; $bar = new CliProgressBar(10, 2); $bar->setBarLength(5); $bar->setColorToRed(); $this->assertEquals($bar->draw(), $expected); }
<?php require_once './../vendor/autoload.php'; use Dariuszp\CliProgressBar; $bar = new CliProgressBar(48); $bar->setBarLength(5); $bar->display(); $bar->setColorToRed(); while ($bar->getCurrentstep() < $bar->getSteps()) { usleep(50000); $bar->progress(); if ($bar->getCurrentstep() >= $bar->getSteps() / 2) { $bar->setColorToYellow(); } } $bar->setColorToGreen(); $bar->display(); $bar->end();