Skip to content

Commit da4c09b

Browse files
test(*): Code smell
1 parent 4334d0f commit da4c09b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

tests/Integration/IpVerificationTest.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
namespace CrowdSecBouncer\Tests\Integration;
66

7-
use CrowdSecBouncer\ApiCache;
8-
use CrowdSecBouncer\ApiClient;
97
use CrowdSecBouncer\Bouncer;
108
use CrowdSecBouncer\Constants;
11-
use PHPUnit\Framework\MockObject\MockObject;
129
use PHPUnit\Framework\TestCase;
1310
use Psr\Log\LoggerInterface;
1411

@@ -49,7 +46,7 @@ public function testCanVerifyIpInLiveModeWithCacheSystem($cacheAdapterName, $ori
4946
'api_key' => TestHelpers::getBouncerKey(),
5047
'api_url' => TestHelpers::getLapiUrl(),
5148
'use_curl' => $this->useCurl,
52-
'api_user_agent' => 'Unit test/'.Constants::BASE_USER_AGENT,
49+
'api_user_agent' => TestHelpers::UNIT_TEST_AGENT_PREFIX . '/' . Constants::BASE_USER_AGENT,
5350
'cache_system' => $cacheAdapterName,
5451
'redis_dsn' => getenv('REDIS_DSN'),
5552
'memcached_dsn' => getenv('MEMCACHED_DSN'),
@@ -159,7 +156,7 @@ public function testCanVerifyIpInStreamModeWithCacheSystem($cacheAdapterName, $o
159156
$bouncerConfigs = [
160157
'api_key' => TestHelpers::getBouncerKey(),
161158
'api_url' => TestHelpers::getLapiUrl(),
162-
'api_user_agent' => 'Unit test/'.Constants::BASE_USER_AGENT,
159+
'api_user_agent' => TestHelpers::UNIT_TEST_AGENT_PREFIX . '/' . Constants::BASE_USER_AGENT,
163160
'stream_mode' => true,
164161
'use_curl' => $this->useCurl,
165162
'cache_system' => $cacheAdapterName,
@@ -260,7 +257,7 @@ public function testCanVerifyIpInStreamModeWithCacheSystem($cacheAdapterName, $o
260257
'api_url' => TestHelpers::getLapiUrl(),
261258
'stream_mode' => true,
262259
'use_curl' => $this->useCurl,
263-
'api_user_agent' => 'Unit test/'.Constants::BASE_USER_AGENT,
260+
'api_user_agent' => TestHelpers::UNIT_TEST_AGENT_PREFIX . '/' . Constants::BASE_USER_AGENT,
264261
'cache_system' => $cacheAdapterName,
265262
'redis_dsn' => getenv('REDIS_DSN'),
266263
'memcached_dsn' => getenv('MEMCACHED_DSN'),

tests/Integration/TestHelpers.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class TestHelpers
2828
public const JAPAN = 'JP';
2929
public const IP_JAPAN = '210.249.74.42';
3030
public const IP_FRANCE = '78.119.253.85';
31+
public const UNIT_TEST_AGENT_PREFIX = 'Unit test';
3132

3233
public const PHP_FILES_CACHE_ADAPTER_DIR = __DIR__.'/../var/phpFiles.cache';
3334

0 commit comments

Comments
 (0)