added project detail report (#2651)
- avatars via css only - random colors for entities - improves print view - added colors for teams - added color to tag
This commit is contained in:
@@ -30,7 +30,7 @@ class ExtensionsTest extends TestCase
|
||||
|
||||
public function testGetFilters()
|
||||
{
|
||||
$filters = ['docu_link', 'multiline_indent', 'color', 'font_contrast', 'nl2str'];
|
||||
$filters = ['docu_link', 'multiline_indent', 'color', 'font_contrast', 'default_color', 'nl2str'];
|
||||
$sut = $this->getSut();
|
||||
$twigFilters = $sut->getFilters();
|
||||
$this->assertCount(\count($filters), $twigFilters);
|
||||
@@ -42,14 +42,14 @@ class ExtensionsTest extends TestCase
|
||||
}
|
||||
|
||||
// make sure that the nl2str filters does proper escaping
|
||||
self::assertEquals('nl2str', $twigFilters[4]->getName());
|
||||
self::assertEquals('html', $twigFilters[4]->getPreEscape());
|
||||
self::assertEquals(['html'], $twigFilters[4]->getSafe(new Node()));
|
||||
self::assertEquals('nl2str', $twigFilters[5]->getName());
|
||||
self::assertEquals('html', $twigFilters[5]->getPreEscape());
|
||||
self::assertEquals(['html'], $twigFilters[5]->getSafe(new Node()));
|
||||
}
|
||||
|
||||
public function testGetFunctions()
|
||||
{
|
||||
$functions = ['class_name', 'iso_day_by_name'];
|
||||
$functions = ['class_name', 'iso_day_by_name', 'random_color'];
|
||||
$sut = $this->getSut();
|
||||
$twigFunctions = $sut->getFunctions();
|
||||
$this->assertCount(\count($functions), $twigFunctions);
|
||||
@@ -189,4 +189,31 @@ sdfsdf' . PHP_EOL . "\n" .
|
||||
|
||||
self::assertEquals($expected, $sut->replaceNewline($input, $replacer));
|
||||
}
|
||||
|
||||
public function testGetRandomColor()
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
$this->assertIsValidColor($sut->randomColor());
|
||||
|
||||
$fooColor = $sut->randomColor('foo-bar');
|
||||
self::assertIsValidColor($fooColor);
|
||||
self::assertEquals($fooColor, $sut->randomColor('foo-bar'));
|
||||
}
|
||||
|
||||
public function testGetDefaultColor()
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
self::assertEquals('#123456', $sut->defaultColor('#123456'));
|
||||
self::assertEquals(Constants::DEFAULT_COLOR, $sut->defaultColor(null));
|
||||
self::assertEquals(Constants::DEFAULT_COLOR, $sut->defaultColor());
|
||||
self::assertEquals('', $sut->defaultColor(''));
|
||||
}
|
||||
|
||||
private static function assertIsValidColor(string $color)
|
||||
{
|
||||
self::assertStringStartsWith('#', $color);
|
||||
self::assertEquals(7, \strlen($color));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user