Skip to content

Commit 1b2160a

Browse files
committed
Revert "Fixup"
This reverts commit 1222884.
1 parent 934bfb6 commit 1b2160a

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

webapp/tests/Unit/Twig/TwigExtensionTest.php

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

5353
class TwigExtensionTest extends WebTestCase
5454
{
55-
protected function setUp(): void
56-
{
57-
self::bootKernel();
58-
}
59-
6055
/**
6156
* Test that the APCA contrast function returns the correct data
6257
*/
6358
public function testApcaContrast(): void
6459
{
65-
$container = self::$kernel->getContainer();
66-
$env = $container->get('twig');
67-
6860
$dj = self::getContainer()->get(DOMJudgeService::class);
6961
$config = self::getContainer()->get(ConfigurationService::class);
7062
$submissionService = self::getContainer()->get(SubmissionService::class);
@@ -74,6 +66,7 @@ public function testApcaContrast(): void
7466
$tokenStorage = static::getContainer()->get(TokenStorageInterface::class);
7567
$authorizationChecker = static::getContainer()->get(AuthorizationCheckerInterface::class);
7668
$router = static::getContainer()->get(RouterInterface::class);
69+
$env = new Environment();
7770
$twigExt = new TwigExtension($dj, $config, $env, $em, $submissionService,
7871
$eventLogService, $awards, $tokenStorage,
7972
$authorizationChecker, $router, "");
@@ -85,7 +78,7 @@ public function testApcaContrast(): void
8578
self::assertEquals(0.0, $twigExt->apcaContrast("#11223344", "#00110011"));
8679
}
8780

88-
/*public function testRelativeLuminance(): void
81+
public function testRelativeLuminance(): void
8982
{
9083
$twigExt = new TwigExtension();
9184
self::assertEquals(0.0, $twigExt->relativeLuminance("#000000"));
@@ -94,13 +87,4 @@ public function testApcaContrast(): void
9487
self::assertEquals(0.0, $twigExt->relativeLuminance("#123"));
9588
self::assertEquals(0.0, $twigExt->relativeLuminance("#1234"));
9689
}
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-
}*/
10690
}

webapp/tests/Unit/Utils/UtilsTest.php

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

389+
public function testApcaContrast(): void
390+
{
391+
self::assertEquals('#ffffff', Utils::apcaContrast("#fff", "#fff"));
392+
}
393+
394+
public function testHexToForegroundAndBorder(): void
395+
{
396+
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#fff"));
397+
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#fedc"));
398+
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#001122"));
399+
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#11223344"));
400+
self::assertEquals(['#ffffff', '#ffffff'], Utils::hexToForegroundAndBorder("#0123"));
401+
}
402+
389403
/**
390404
* Test function that converts colour hex notation to (nearest) name.
391405
* If value is not hexadecimal, return it unchanged.

0 commit comments

Comments
 (0)