Skip to content

Commit

Permalink
testTestTitilesAreColored
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotchance committed Sep 8, 2014
1 parent a5b6802 commit a5825d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Concise/Console/ResultPrinter/Utilities/RenderIssue.php
Expand Up @@ -29,7 +29,8 @@ public function render($status, $issueNumber, PHPUnit_Framework_TestCase $test,
$c = new Color();
$theme = new DefaultTheme();
$colors = $theme->getTheme();
$top = "$issueNumber. " . get_class($test) . '::' . $test->getName() . "\n\n";
$color = $colors[$status];
$top = "$issueNumber. " . $c(get_class($test) . '::' . $test->getName())->$color . "\n\n";
$message = $e->getMessage() . "\n\n";
$message .= $this->prefixLines("\033[90m", $this->traceSimplifier->render($e->getTrace())) . "\033[0m";
$pad = str_repeat(' ', strlen($issueNumber));
Expand Down
12 changes: 12 additions & 0 deletions tests/Concise/Console/ResultPrinter/Utilities/RenderIssueTest.php
Expand Up @@ -5,6 +5,7 @@
use Concise\TestCase;
use Exception;
use PHPUnit_Runner_BaseTestRunner;
use Colors\Color;

class RenderIssueTest extends TestCase
{
Expand Down Expand Up @@ -101,4 +102,15 @@ public function testWhenIssueNumberGoesAbove10ExtraPaddingWillBeProvidedToKeepIt
$result = $this->render(PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE, 10);
$this->assert($result, contains_string, "\033[41m \033[0m ");
}

public function testTestTitilesAreColored()
{
$c = new Color();
$this->test = $this->mock('PHPUnit_Framework_TestCase')
->setCustomClassName('PHPUnit_Framework_TestCase_57c3cc10')
->stub(array('getName' => 'foo'))
->done();
$result = $this->render(PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE, 10);
$this->assert($result, contains_string, (string) $c("PHPUnit_Framework_TestCase_57c3cc10::foo")->red());
}
}

0 comments on commit a5825d7

Please sign in to comment.