Skip to content

Commit a26dc09

Browse files
freezy-skfabpot
authored andcommitted
[Console] Test degraded true colors
1 parent abcc0b8 commit a26dc09

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Symfony/Component/Console/Tests/ColorTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,20 @@ public function testTrueColors()
4040
$color = new Color('#ffffff', '#000000');
4141
$this->assertSame("\033[38;2;255;255;255;48;2;0;0;0m \033[39;49m", $color->apply(' '));
4242
}
43+
44+
public function testDegradedTrueColors()
45+
{
46+
$colorterm = getenv('COLORTERM');
47+
putenv('COLORTERM=');
48+
49+
try {
50+
$color = new Color('#f00', '#ff0');
51+
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
52+
53+
$color = new Color('#c0392b', '#f1c40f');
54+
$this->assertSame("\033[31;43m \033[39;49m", $color->apply(' '));
55+
} finally {
56+
putenv('COLORTERM='.$colorterm);
57+
}
58+
}
4359
}

0 commit comments

Comments
 (0)