52
52
53
53
class TwigExtensionTest extends WebTestCase
54
54
{
55
+ protected function setUp (): void
56
+ {
57
+ self ::bootKernel ();
58
+ }
59
+
55
60
/**
56
61
* Test that the APCA contrast function returns the correct data
57
62
*/
58
63
public function testApcaContrast (): void
59
64
{
65
+ $ container = self ::$ kernel ->getContainer ();
66
+ $ env = $ container ->get ('twig ' );
67
+
60
68
$ dj = self ::getContainer ()->get (DOMJudgeService::class);
61
69
$ config = self ::getContainer ()->get (ConfigurationService::class);
62
70
$ submissionService = self ::getContainer ()->get (SubmissionService::class);
@@ -66,7 +74,6 @@ public function testApcaContrast(): void
66
74
$ tokenStorage = static ::getContainer ()->get (TokenStorageInterface::class);
67
75
$ authorizationChecker = static ::getContainer ()->get (AuthorizationCheckerInterface::class);
68
76
$ router = static ::getContainer ()->get (RouterInterface::class);
69
- $ env = new Environment ();
70
77
$ twigExt = new TwigExtension ($ dj , $ config , $ env , $ em , $ submissionService ,
71
78
$ eventLogService , $ awards , $ tokenStorage ,
72
79
$ authorizationChecker , $ router , "" );
@@ -78,7 +85,7 @@ public function testApcaContrast(): void
78
85
self ::assertEquals (0.0 , $ twigExt ->apcaContrast ("#11223344 " , "#00110011 " ));
79
86
}
80
87
81
- public function testRelativeLuminance (): void
88
+ /* public function testRelativeLuminance(): void
82
89
{
83
90
$twigExt = new TwigExtension();
84
91
self::assertEquals(0.0, $twigExt->relativeLuminance("#000000"));
@@ -87,4 +94,13 @@ public function testRelativeLuminance(): void
87
94
self::assertEquals(0.0, $twigExt->relativeLuminance("#123"));
88
95
self::assertEquals(0.0, $twigExt->relativeLuminance("#1234"));
89
96
}
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
+ }*/
90
106
}
0 commit comments