File tree Expand file tree Collapse file tree 2 files changed +27
-12
lines changed
Expand file tree Collapse file tree 2 files changed +27
-12
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+ /*
3+ * This file is part of Aplus Framework HTTP Library.
4+ *
5+ * (c) Natan Felles <natanfelles@gmail.com>
6+ *
7+ * For the full copyright and license information, please view the LICENSE
8+ * file that was distributed with this source code.
9+ */
10+ namespace Tests \HTTP ;
11+
12+ use Framework \HTTP \CSP ;
13+
14+ class CSPMock extends CSP
15+ {
16+ public function getNonceAttr (string $ type ) : string
17+ {
18+ return parent ::getNonceAttr ($ type );
19+ }
20+
21+ public function sanitizeValue (string $ value ) : string
22+ {
23+ return parent ::sanitizeValue ($ value );
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -178,12 +178,7 @@ public function testStyleNonceAttr() : void
178178
179179 public function testInvalidNonceAttr () : void
180180 {
181- $ csp = new class () extends CSP {
182- public function getNonceAttr (string $ type ) : string
183- {
184- return parent ::getNonceAttr ($ type );
185- }
186- };
181+ $ csp = new CSPMock ();
187182 $ this ->expectException (\InvalidArgumentException::class);
188183 $ this ->expectExceptionMessage ('Invalid CSP directive: foo ' );
189184 $ csp ->getNonceAttr ('foo ' );
@@ -283,12 +278,7 @@ public function testMakeHash() : void
283278
284279 public function testSanitizeValue () : void
285280 {
286- $ csp = new class () extends CSP {
287- public function sanitizeValue (string $ value ) : string
288- {
289- return parent ::sanitizeValue ($ value );
290- }
291- };
281+ $ csp = new CSPMock ();
292282 self ::assertSame ("'none' " , $ csp ->sanitizeValue ('none ' ));
293283 self ::assertSame ("'self' " , $ csp ->sanitizeValue ('self ' ));
294284 self ::assertSame ("'strict-dynamic' " , $ csp ->sanitizeValue ('strict-dynamic ' ));
You can’t perform that action at this time.
0 commit comments