Skip to content

Commit

Permalink
Make room to fix #3513 with a color-independent progress spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
epdenouden authored and sebastianbergmann committed Feb 14, 2019
1 parent eeba3b8 commit 11c1450
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public function doRun(Test $suite, array $arguments = [], bool $exit = true): Te
if (isset($originalExecutionOrder) && ($this->printer instanceof CliTestDoxPrinter)) {
/* @var CliTestDoxPrinter */
$this->printer->setOriginalExecutionOrder($originalExecutionOrder);
// $this->printer->setShowProgressAnimation(true);
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/Util/TestDox/TestDoxPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ class TestDoxPrinter extends ResultPrinter
*/
protected $spinState = 0;

/**
* @var bool
*/
protected $showProgress = true;

/**
* @param null|resource|string $out
*
Expand All @@ -83,6 +88,11 @@ public function setOriginalExecutionOrder(array $order): void
$this->enableOutputBuffer = !empty($order);
}

public function setShowProgressAnimation(bool $doShowSpinner): void
{
$this->showProgress = $doShowSpinner;
}

public function printResult(TestResult $result): void
{
}
Expand Down Expand Up @@ -260,18 +270,28 @@ protected function flushOutputBuffer(): void

protected function showSpinner(): void
{
if (!$this->showProgress) {
return;
}

if ($this->spinState) {
$this->undrawSpinner();
}

$this->spinState++;
$this->drawSpinner();
}

protected function hideSpinner(): void
{
if (!$this->showProgress) {
return;
}

if ($this->spinState) {
$this->undrawSpinner();
}

$this->spinState = 0;
}

Expand Down

0 comments on commit 11c1450

Please sign in to comment.