11<?php
22
3- namespace Api ;
3+ namespace App \ Tests \ Api ;
44
5- use App \Tests \Api \ECampApiTestCase ;
65use App \Util \ParametrizedTestHelper ;
6+ use Doctrine \Bundle \DoctrineBundle \DataCollector \DoctrineDataCollector ;
77use PHPUnit \Framework \Attributes \DataProvider ;
88use Symfony \Contracts \HttpClient \Exception \ClientExceptionInterface ;
99use Symfony \Contracts \HttpClient \Exception \DecodingExceptionInterface ;
@@ -26,12 +26,15 @@ class FirewallTest extends ECampApiTestCase {
2626 * @throws ServerExceptionInterface
2727 * @throws TransportExceptionInterface
2828 */
29- #[DataProvider('getProtectedEnpoints ' )]
29+ #[DataProvider('getProtectedEndpoints ' )]
3030 public function testProtectedEndpointsDontResultInQuery (string $ endpoint ) {
3131 $ client = self ::createBasicClient ();
3232 $ client ->enableProfiler ();
3333 $ client ->request ('GET ' , $ endpoint );
3434
35+ /**
36+ * @var DoctrineDataCollector
37+ */
3538 $ collector = $ client ->getProfile ()->getCollector ('db ' );
3639 /*
3740 * 3 is:
@@ -42,12 +45,12 @@ public function testProtectedEndpointsDontResultInQuery(string $endpoint) {
4245 assertThat ($ collector ->getQueryCount (), equalTo (3 ));
4346 }
4447
45- public static function getProtectedEnpoints (): array {
46- $ protectedEnpoints = array_filter (self ::getEndPoints (), function (string $ endpoint ) {
48+ public static function getProtectedEndpoints (): array {
49+ $ protectedEndpoints = array_filter (self ::getEndPoints (), function (string $ endpoint ) {
4750 return self ::isProtectedByFirewall ($ endpoint );
4851 });
4952
50- return ParametrizedTestHelper::asParameterTestSets ($ protectedEnpoints );
53+ return ParametrizedTestHelper::asParameterTestSets ($ protectedEndpoints );
5154 }
5255
5356 /**
@@ -57,12 +60,15 @@ public static function getProtectedEnpoints(): array {
5760 * @throws ServerExceptionInterface
5861 * @throws TransportExceptionInterface
5962 */
60- #[DataProvider('getUnprotectedEnpoints ' )]
63+ #[DataProvider('getUnprotectedEndpoints ' )]
6164 public function testUnprotectedEndpointsMayResultInQuery (string $ endpoint ) {
6265 $ client = self ::createBasicClient ();
6366 $ client ->enableProfiler ();
6467 $ client ->request ('GET ' , $ endpoint );
6568
69+ /**
70+ * @var DoctrineDataCollector
71+ */
6672 $ collector = $ client ->getProfile ()->getCollector ('db ' );
6773 /*
6874 * 3 is:
@@ -73,12 +79,12 @@ public function testUnprotectedEndpointsMayResultInQuery(string $endpoint) {
7379 assertThat ($ collector ->getQueryCount (), greaterThanOrEqual (3 ));
7480 }
7581
76- public static function getUnprotectedEnpoints () {
77- $ protectedEnpoints = array_filter (self ::getEndPoints (), function (string $ endpoint ) {
82+ public static function getUnprotectedEndpoints () {
83+ $ protectedEndpoints = array_filter (self ::getEndPoints (), function (string $ endpoint ) {
7884 return !self ::isProtectedByFirewall ($ endpoint );
7985 });
8086
81- return ParametrizedTestHelper::asParameterTestSets ($ protectedEnpoints );
87+ return ParametrizedTestHelper::asParameterTestSets ($ protectedEndpoints );
8288 }
8389
8490 /**
0 commit comments