Skip to content

Commit d990e89

Browse files
committed
Fixup
1 parent 1798780 commit d990e89

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

webapp/tests/Unit/Twig/TwigExtensionTest.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@
5252

5353
class TwigExtensionTest extends WebTestCase
5454
{
55+
protected function setUp(): void
56+
{
57+
self::bootKernel();
58+
}
59+
5560
/**
5661
* Test that the APCA contrast function returns the correct data
5762
*/
5863
public function testApcaContrast(): void
5964
{
65+
$container = self::$kernel->getContainer();
66+
$env = $container->get('twig');
67+
6068
$dj = self::getContainer()->get(DOMJudgeService::class);
6169
$config = self::getContainer()->get(ConfigurationService::class);
6270
$submissionService = self::getContainer()->get(SubmissionService::class);
@@ -66,7 +74,6 @@ public function testApcaContrast(): void
6674
$tokenStorage = static::getContainer()->get(TokenStorageInterface::class);
6775
$authorizationChecker = static::getContainer()->get(AuthorizationCheckerInterface::class);
6876
$router = static::getContainer()->get(RouterInterface::class);
69-
$env = new Environment();
7077
$twigExt = new TwigExtension($dj, $config, $env, $em, $submissionService,
7178
$eventLogService, $awards, $tokenStorage,
7279
$authorizationChecker, $router, "");
@@ -78,7 +85,7 @@ public function testApcaContrast(): void
7885
self::assertEquals(0.0, $twigExt->apcaContrast("#11223344", "#00110011"));
7986
}
8087

81-
public function testRelativeLuminance(): void
88+
/*public function testRelativeLuminance(): void
8289
{
8390
$twigExt = new TwigExtension();
8491
self::assertEquals(0.0, $twigExt->relativeLuminance("#000000"));
@@ -87,4 +94,13 @@ public function testRelativeLuminance(): void
8794
self::assertEquals(0.0, $twigExt->relativeLuminance("#123"));
8895
self::assertEquals(0.0, $twigExt->relativeLuminance("#1234"));
8996
}
97+
98+
public function testHexToForegroundAndBorder(): void
99+
{
100+
self::assertEquals(['#ffffff', '#ffffff'], $twigExt->hexToForegroundAndBorder("#fff"));
101+
self::assertEquals(['#ffffff', '#ffffff'], $twigExt->hexToForegroundAndBorder("#fedc"));
102+
self::assertEquals(['#ffffff', '#ffffff'], $twigExt->hexToForegroundAndBorder("#001122"));
103+
self::assertEquals(['#ffffff', '#ffffff'], $twigExt->hexToForegroundAndBorder("#11223344"));
104+
self::assertEquals(['#ffffff', '#ffffff'], $twigExt->hexToForegroundAndBorder("#0123"));
105+
}*/
90106
}

webapp/tests/Unit/Utils/UtilsTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,6 @@ public function testConvertToHexUnknown(): void
354354
self::assertNull(Utils::convertToHex('#12346h'));
355355
}
356356

357-
public function testApcaContrast(): void
358-
{
359-
self::assertEquals('#ffffff', Utils::apcaContrast("#fff", "#fff"));
360-
}
361-
362-
public function testHexToForegroundAndBorder(): void
363-
{
364-
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#fff"));
365-
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#fedc"));
366-
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#001122"));
367-
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#11223344"));
368-
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#0123"));
369-
}
370-
371357
/**
372358
* Test function that converts colour hex notation to (nearest) name.
373359
* If value is not hexadecimal, return it unchanged.

0 commit comments

Comments
 (0)