@@ -53,13 +53,7 @@ public function testRenderRestrictMode(): void
53
53
54
54
$ this ->assertNotEmpty ($ header = $ this ->response ->getHeader ('Content-Security-Policy ' ));
55
55
$ this ->assertEmpty ($ this ->response ->getHeader ('Content-Security-Policy-Report-Only ' ));
56
- $ contentSecurityPolicyContent = [];
57
- if ($ header instanceof \ArrayIterator) {
58
- foreach ($ header as $ item ) {
59
- $ contentSecurityPolicyContent [] = $ item ->getFieldValue ();
60
- }
61
- }
62
- $ this ->assertEquals (['default-src https://magento.com \'self \'; ' ], $ contentSecurityPolicyContent );
56
+ $ this ->assertEquals ('default-src https://magento.com \'self \'; ' , $ header ->getFieldValue ());
63
57
}
64
58
65
59
/**
@@ -79,15 +73,9 @@ public function testRenderRestrictWithReportingMode(): void
79
73
80
74
$ this ->assertNotEmpty ($ header = $ this ->response ->getHeader ('Content-Security-Policy ' ));
81
75
$ this ->assertEmpty ($ this ->response ->getHeader ('Content-Security-Policy-Report-Only ' ));
82
- $ contentSecurityPolicyContent = [];
83
- if ($ header instanceof \ArrayIterator) {
84
- foreach ($ header as $ item ) {
85
- $ contentSecurityPolicyContent [] = $ item ->getFieldValue ();
86
- }
87
- }
88
76
$ this ->assertEquals (
89
- [ 'default-src https://magento.com \'self \'; report-uri /csp-reports/; report-to report-endpoint; ' ] ,
90
- $ contentSecurityPolicyContent
77
+ 'default-src https://magento.com \'self \'; report-uri /csp-reports/; report-to report-endpoint; ' ,
78
+ $ header -> getFieldValue ()
91
79
);
92
80
$ this ->assertNotEmpty ($ reportToHeader = $ this ->response ->getHeader ('Report-To ' ));
93
81
$ this ->assertNotEmpty ($ reportData = json_decode ("[ {$ reportToHeader ->getFieldValue ()}] " , true ));
0 commit comments