Skip to content

Commit 39f93fd

Browse files
authored
Merge pull request ecamp#5391 from usu/fix/test-namespaces
fix: test namespaces + some typos
2 parents 3a7359f + 0c618d6 commit 39f93fd

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

api/tests/Api/FirewallTest.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace Api;
3+
namespace App\Tests\Api;
44

5-
use App\Tests\Api\ECampApiTestCase;
65
use App\Util\ParametrizedTestHelper;
6+
use Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector;
77
use PHPUnit\Framework\Attributes\DataProvider;
88
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
99
use 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
/**

api/tests/HttpCache/TagCollectorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace App\Tests\HttpCache;
4+
35
use ApiPlatform\Metadata\ApiProperty;
46
use ApiPlatform\Serializer\TagCollectorInterface;
57
use App\HttpCache\ResponseTagger;

0 commit comments

Comments
 (0)