diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml
index cd1a2f84..1155039f 100644
--- a/.github/workflows/test-pr.yml
+++ b/.github/workflows/test-pr.yml
@@ -9,20 +9,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
-env:
- BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
- BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
- BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
- BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
- BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
- BW_NUMBER: ${{ secrets.BW_NUMBER }}
- USER_NUMBER: ${{ secrets.USER_NUMBER }}
- BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
- MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
- MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
- MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
- MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
-
jobs:
test:
name: Test PR
diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml
index 4c3468d3..fd20e836 100644
--- a/.github/workflows/test-smoke.yml
+++ b/.github/workflows/test-smoke.yml
@@ -5,7 +5,7 @@ on:
- cron: "0 4 * * *"
pull_request:
paths:
- - "spec/smoke/*"
+ - "tests/Smoke/**"
- ".github/workflows/test-smoke.yml"
concurrency:
diff --git a/tests/Smoke/CallsApiTest.php b/tests/Smoke/CallsApiTest.php
index 61e4f441..f478f802 100644
--- a/tests/Smoke/CallsApiTest.php
+++ b/tests/Smoke/CallsApiTest.php
@@ -38,7 +38,7 @@
use Bandwidth\Model\MachineDetectionConfiguration;
use Bandwidth\Model\MachineDetectionModeEnum;
use Bandwidth\Model\UpdateCall;
-use Bandwidth\Test\Utils\CallCleanup;
+use Bandwidth\Test\Smoke\Utils\CallCleanup;
use PHPUnit\Framework\TestCase;
diff --git a/tests/Smoke/ConferencesApiTest.php b/tests/Smoke/ConferencesApiTest.php
index fef44b19..a6afc40e 100644
--- a/tests/Smoke/ConferencesApiTest.php
+++ b/tests/Smoke/ConferencesApiTest.php
@@ -39,8 +39,8 @@
use Bandwidth\Model\RedirectMethodEnum;
use Bandwidth\Model\UpdateConference;
use Bandwidth\Model\UpdateConferenceMember;
-use Bandwidth\Test\Utils\CallCleanup;
-use Bandwidth\Test\Utils\Manteca;
+use Bandwidth\Test\Smoke\Utils\CallCleanup;
+use Bandwidth\Test\Smoke\Utils\Manteca;
use PHPUnit\Framework\TestCase;
diff --git a/tests/Smoke/RecordingsApiTest.php b/tests/Smoke/RecordingsApiTest.php
index 9fe5c587..83385663 100644
--- a/tests/Smoke/RecordingsApiTest.php
+++ b/tests/Smoke/RecordingsApiTest.php
@@ -38,8 +38,8 @@
use Bandwidth\Model\TranscribeRecording;
use Bandwidth\Model\UpdateCall;
use Bandwidth\Model\UpdateCallRecording;
-use Bandwidth\Test\Utils\CallCleanup;
-use Bandwidth\Test\Utils\Manteca;
+use Bandwidth\Test\Smoke\Utils\CallCleanup;
+use Bandwidth\Test\Smoke\Utils\Manteca;
use PHPUnit\Framework\TestCase;
diff --git a/tests/Utils/CallCleanup.php b/tests/Smoke/Utils/CallCleanup.php
similarity index 96%
rename from tests/Utils/CallCleanup.php
rename to tests/Smoke/Utils/CallCleanup.php
index 4275b4c6..b9699ef8 100644
--- a/tests/Utils/CallCleanup.php
+++ b/tests/Smoke/Utils/CallCleanup.php
@@ -6,7 +6,7 @@
* @package Bandwidth
*/
-namespace Bandwidth\Test\Utils;
+namespace Bandwidth\Test\Smoke\Utils;
use Bandwidth\Api\CallsApi;
use Bandwidth\Model\CallStateEnum;
diff --git a/tests/Utils/Manteca.php b/tests/Smoke/Utils/Manteca.php
similarity index 98%
rename from tests/Utils/Manteca.php
rename to tests/Smoke/Utils/Manteca.php
index a8bfae34..707a0834 100644
--- a/tests/Utils/Manteca.php
+++ b/tests/Smoke/Utils/Manteca.php
@@ -6,7 +6,7 @@
* @package Bandwidth
*/
-namespace Bandwidth\Test\Utils;
+namespace Bandwidth\Test\Smoke\Utils;
use GuzzleHttp\Client;
diff --git a/tests/Unit/Api/CallsApiTest.php b/tests/Unit/Api/CallsApiTest.php
index d497838c..196cb735 100644
--- a/tests/Unit/Api/CallsApiTest.php
+++ b/tests/Unit/Api/CallsApiTest.php
@@ -38,6 +38,7 @@
use Bandwidth\Model\MachineDetectionConfiguration;
use Bandwidth\Model\MachineDetectionModeEnum;
use Bandwidth\Model\UpdateCall;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -52,17 +53,11 @@ class CallsApiTest extends TestCase
{
private static CallsApi $apiInstance;
- private static string $account_id;
- private static string $bw_number;
- private static string $user_number;
- private static string $voice_application_id;
private static string $call_id = 'c-1234';
private static string $display_name = 'PHP SDK';
private static CallbackMethodEnum $answer_method = CallbackMethodEnum::POST;
- private static string $answer_url;
private static CallbackMethodEnum $disconnect_method = CallbackMethodEnum::GET;
- private static string $disconnect_url;
private static float $call_timeout = 30.0;
private static float $callback_timeout = 15.0;
@@ -77,13 +72,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new CallsApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
- self::$bw_number = getenv("BW_NUMBER");
- self::$user_number = getenv("USER_NUMBER");
- self::$voice_application_id = getenv("BW_VOICE_APPLICATION_ID");
- self::$answer_url = getenv("BASE_CALLBACK_URL");
- self::$disconnect_url = getenv("BASE_CALLBACK_URL");
}
/**
@@ -101,19 +89,19 @@ public function testCreateCall()
'speech_threshold' => 5.0,
'speech_end_threshold' => 5.0,
'delay_result' => true,
- 'callback_url' => self::$answer_url,
+ 'callback_url' => TestConstants::BASE_CALLBACK_URL,
'callback_method' => CallbackMethodEnum::POST
]);
$create_call = new CreateCall([
- 'application_id' => self::$voice_application_id,
- 'to' => self::$user_number,
- 'from' => self::$bw_number,
+ 'application_id' => TestConstants::VOICE_APPLICATION_ID,
+ 'to' => TestConstants::USER_NUMBER,
+ 'from' => TestConstants::BW_NUMBER,
'privacy' => false,
'display_name' => self::$display_name,
- 'answer_url' => self::$answer_url,
+ 'answer_url' => TestConstants::BASE_CALLBACK_URL,
'answer_method' => self::$answer_method,
- 'disconnect_url' => self::$disconnect_url,
+ 'disconnect_url' => TestConstants::BASE_CALLBACK_URL,
'disconnect_method' => self::$disconnect_method,
'machine_detection' => $machine_detection,
'call_timeout' => self::$call_timeout,
@@ -121,7 +109,7 @@ public function testCreateCall()
]);
[$data, $status_code] = self::$apiInstance->createCallWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$create_call
);
@@ -159,7 +147,7 @@ public function testCreateCall()
public function testGetCallState()
{
[$data, $status_code] = self::$apiInstance->getCallStateWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id
);
@@ -194,9 +182,9 @@ public function testGetCallState()
public function testListCalls()
{
[$data, $status_code] = self::$apiInstance->listCallsWithHttpInfo(
- self::$account_id,
- to: self::$user_number,
- from: self::$bw_number
+ TestConstants::ACCOUNT_ID,
+ to: TestConstants::USER_NUMBER,
+ from: TestConstants::BW_NUMBER
);
$this->assertEquals(200, $status_code);
@@ -234,7 +222,7 @@ public function testUpdateCall()
]);
[, $status_code] = self::$apiInstance->updateCallWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
$update_call
);
@@ -253,7 +241,7 @@ public function testUpdateCallBxml()
$update_call_bxml = '';
[, $status_code] = self::$apiInstance->updateCallBxmlWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
$update_call_bxml
);
diff --git a/tests/Unit/Api/ConferencesApiTest.php b/tests/Unit/Api/ConferencesApiTest.php
index ba3f6a03..01069448 100644
--- a/tests/Unit/Api/ConferencesApiTest.php
+++ b/tests/Unit/Api/ConferencesApiTest.php
@@ -38,6 +38,7 @@
use Bandwidth\Model\RedirectMethodEnum;
use Bandwidth\Model\UpdateConference;
use Bandwidth\Model\UpdateConferenceMember;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -52,12 +53,10 @@ class ConferencesApiTest extends TestCase
{
private static ConferencesApi $apiInstance;
- private static string $account_id;
private static string $call_id = 'c-1234';
private static string $conference_id = 'c-4321';
private static string $recording_id = 'r-1234';
- private static string $callback_url;
/**
* Setup before running any test cases
@@ -70,9 +69,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new ConferencesApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
- self::$callback_url = getenv("BASE_CALLBACK_URL");
}
/**
@@ -86,7 +82,7 @@ public function testDownloadConferenceRecording()
self::markTestSkipped("Can't set the correct Accept header for Prism");
[$data, $status_code] = self::$apiInstance->downloadConferenceRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
self::$recording_id
);
@@ -104,7 +100,7 @@ public function testDownloadConferenceRecording()
public function testGetConference()
{
[$data, $status_code] = self::$apiInstance->getConferenceWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id
);
@@ -128,7 +124,7 @@ public function testGetConference()
public function testGetConferenceMember()
{
[$data, $status_code] = self::$apiInstance->getConferenceMemberWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
self::$call_id
);
@@ -152,7 +148,7 @@ public function testGetConferenceMember()
public function testGetConferenceRecording()
{
[$data, $status_code] = self::$apiInstance->getConferenceRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
self::$recording_id
);
@@ -181,7 +177,7 @@ public function testGetConferenceRecording()
public function testListConferenceRecordings()
{
[$data, $status_code] = self::$apiInstance->listConferenceRecordingsWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id
);
@@ -209,7 +205,7 @@ public function testListConferenceRecordings()
public function testListConferences()
{
[$data, $status_code] = self::$apiInstance->listConferencesWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
name: self::$conference_id
);
@@ -234,18 +230,18 @@ public function testUpdateConference()
{
$update_conference = new UpdateConference([
'status' => ConferenceStateEnum::ACTIVE,
- 'redirect_url' => self::$callback_url,
+ 'redirect_url' => TestConstants::BASE_CALLBACK_URL,
'redirect_method' => RedirectMethodEnum::POST,
'username' => 'username',
'password' => 'password',
- 'redirect_fallback_url' => self::$callback_url,
+ 'redirect_fallback_url' => TestConstants::BASE_CALLBACK_URL,
'redirect_fallback_method' => RedirectMethodEnum::POST,
'fallback_username' => 'username',
'fallback_password' => 'password'
]);
[, $status_code] = self::$apiInstance->updateConferenceWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
$update_conference
);
@@ -264,7 +260,7 @@ public function testUpdateConferenceBxml()
$update_conference_bxml = '';
[, $status_code] = self::$apiInstance->updateConferenceBxmlWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
$update_conference_bxml
);
@@ -287,7 +283,7 @@ public function testUpdateConferenceMember()
]);
[, $status_code] = self::$apiInstance->updateConferenceMemberWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$conference_id,
self::$call_id,
$update_conference_member
diff --git a/tests/Unit/Api/EndpointsApiTest.php b/tests/Unit/Api/EndpointsApiTest.php
index 2157e7a2..cd7e39c4 100644
--- a/tests/Unit/Api/EndpointsApiTest.php
+++ b/tests/Unit/Api/EndpointsApiTest.php
@@ -40,6 +40,7 @@
use Bandwidth\Model\EndpointTypeEnum;
use Bandwidth\Model\ListEndpointsResponse;
use Bandwidth\Model\Page;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -54,7 +55,6 @@ class EndpointsApiTest extends TestCase
{
private static EndpointsApi $apiInstance;
- private static string $account_id;
private static string $endpoint_id = 'test-endpoint-id';
private static string $bxml = 'Hello';
@@ -70,8 +70,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new EndpointsApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
}
/**
@@ -88,7 +86,7 @@ public function testCreateEndpoint()
]);
[$data, $status_code] = self::$apiInstance->createEndpointWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$endpoint_body
);
@@ -116,7 +114,7 @@ public function testCreateEndpoint()
public function testDeleteEndpoint()
{
[, $status_code] = self::$apiInstance->deleteEndpointWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$endpoint_id
);
@@ -132,7 +130,7 @@ public function testDeleteEndpoint()
public function testGetEndpoint()
{
[$data, $status_code] = self::$apiInstance->getEndpointWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$endpoint_id
);
@@ -159,7 +157,7 @@ public function testGetEndpoint()
public function testListEndpoints()
{
[$data, $status_code] = self::$apiInstance->listEndpointsWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
@@ -186,7 +184,7 @@ public function testListEndpoints()
public function testUpdateEndpointBxml()
{
[, $status_code] = self::$apiInstance->updateEndpointBxmlWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$endpoint_id,
self::$bxml
);
diff --git a/tests/Unit/Api/MFAApiTest.php b/tests/Unit/Api/MFAApiTest.php
index f0dc5a7f..7ab8e3d2 100644
--- a/tests/Unit/Api/MFAApiTest.php
+++ b/tests/Unit/Api/MFAApiTest.php
@@ -34,6 +34,7 @@
use Bandwidth\Model\VerifyCodeRequest;
use Bandwidth\Model\VerifyCodeResponse;
use Bandwidth\Model\VoiceCodeResponse;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -48,11 +49,6 @@ class MFAApiTest extends TestCase
{
private static MFAApi $apiInstance;
- private static string $account_id;
- private static string $bw_number;
- private static string $user_number;
- private static string $messaging_application_id;
- private static string $voice_application_id;
private static string $message = 'Your temporary {NAME} {SCOPE} code is {CODE}';
private static int $digits = 6;
@@ -68,12 +64,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new MFAApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
- self::$bw_number = getenv("BW_NUMBER");
- self::$user_number = getenv("USER_NUMBER");
- self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID");
- self::$voice_application_id = getenv("BW_VOICE_APPLICATION_ID");
}
/**
@@ -85,15 +75,15 @@ public static function setUpBeforeClass(): void
public function testGenerateMessagingCode()
{
$code_request = new CodeRequest([
- 'to' => self::$user_number,
- 'from' => self::$bw_number,
- 'application_id' => self::$messaging_application_id,
+ 'to' => TestConstants::USER_NUMBER,
+ 'from' => TestConstants::BW_NUMBER,
+ 'application_id' => TestConstants::MESSAGING_APPLICATION_ID,
'message' => self::$message,
'digits' => self::$digits
]);
[$data, $status_code] = self::$apiInstance->generateMessagingCodeWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$code_request
);
@@ -111,15 +101,15 @@ public function testGenerateMessagingCode()
public function testGenerateVoiceCode()
{
$code_request = new CodeRequest([
- 'to' => self::$user_number,
- 'from' => self::$bw_number,
- 'application_id' => self::$voice_application_id,
+ 'to' => TestConstants::USER_NUMBER,
+ 'from' => TestConstants::BW_NUMBER,
+ 'application_id' => TestConstants::VOICE_APPLICATION_ID,
'message' => self::$message,
'digits' => self::$digits
]);
[$data, $status_code] = self::$apiInstance->generateVoiceCodeWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$code_request
);
@@ -137,14 +127,14 @@ public function testGenerateVoiceCode()
public function testVerifyCode()
{
$verify_code_request = new VerifyCodeRequest([
- 'to' => self::$user_number,
+ 'to' => TestConstants::USER_NUMBER,
'scope' => 'login',
'expiration_time_in_minutes' => 3.0,
'code' => '12345'
]);
[$data, $status_code] = self::$apiInstance->verifyCodeWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$verify_code_request
);
diff --git a/tests/Unit/Api/MediaApiTest.php b/tests/Unit/Api/MediaApiTest.php
index 48e23d56..bf64c696 100644
--- a/tests/Unit/Api/MediaApiTest.php
+++ b/tests/Unit/Api/MediaApiTest.php
@@ -30,6 +30,7 @@
use Bandwidth\Configuration;
use Bandwidth\Api\MediaApi;
use Bandwidth\Model\Media;
+use Bandwidth\Test\Unit\TestConstants;
use SplFileObject;
use PHPUnit\Framework\TestCase;
@@ -45,7 +46,6 @@ class MediaApiTest extends TestCase
{
private static MediaApi $apiInstance;
- private static string $account_id;
private static string $media_name = 'php_binary_media';
private static SplFileObject $media_file;
@@ -62,8 +62,6 @@ public static function setUpBeforeClass(): void
self::$apiInstance = new MediaApi(config: $config);
- self::$account_id = getenv("BW_ACCOUNT_ID");
-
$path = tempnam(sys_get_temp_dir(), 'bw_media_');
file_put_contents($path, "123456");
self::$media_file = new SplFileObject($path, 'rb');
@@ -78,7 +76,7 @@ public static function setUpBeforeClass(): void
public function testDeleteMedia()
{
[, $status_code] = self::$apiInstance->deleteMediaWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$media_name
);
@@ -96,7 +94,7 @@ public function testGetMedia()
self::markTestSkipped("Can't set the correct Accept header for Prism");
[$data, $status_code] = self::$apiInstance->getMediaWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$media_name
);
@@ -113,7 +111,7 @@ public function testGetMedia()
public function testListMedia()
{
[$data, $status_code] = self::$apiInstance->listMediaWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
@@ -134,7 +132,7 @@ public function testUploadMedia()
self::markTestSkipped("Can't set the correct Content-Type and Accept headers for Prism");
[, $status_code] = self::$apiInstance->uploadMediaWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$media_name,
self::$media_file,
content_type: 'image/jpeg',
diff --git a/tests/Unit/Api/MessagesApiTest.php b/tests/Unit/Api/MessagesApiTest.php
index c0aac1b9..e3dec7cc 100644
--- a/tests/Unit/Api/MessagesApiTest.php
+++ b/tests/Unit/Api/MessagesApiTest.php
@@ -39,6 +39,7 @@
use Bandwidth\Model\MessageTypeEnum;
use Bandwidth\Model\PageInfo;
use Bandwidth\Model\PriorityEnum;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -53,9 +54,6 @@ class MessagesApiTest extends TestCase
{
private static MessagesApi $apiInstance;
- private static string $account_id;
- private static string $bw_number;
- private static string $messaging_application_id;
private static string $message_text = 'PHP SDK Test Message';
private static PriorityEnum $message_priority = PriorityEnum::HIGH;
@@ -73,10 +71,6 @@ public static function setUpBeforeClass(): void
self::$apiInstance = new MessagesApi(config: $config);
- self::$account_id = getenv("BW_ACCOUNT_ID");
- self::$bw_number = getenv("BW_NUMBER");
- self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID");
-
self::$expiration = (new \DateTime('@' . strtotime('+1 day')))
->setTimezone(new \DateTimeZone('UTC'));
}
@@ -90,16 +84,16 @@ public static function setUpBeforeClass(): void
public function testCreateMessage()
{
$message_request = new MessageRequest([
- 'application_id' => self::$messaging_application_id,
- 'from' => self::$bw_number,
- 'to' => [self::$bw_number],
+ 'application_id' => TestConstants::MESSAGING_APPLICATION_ID,
+ 'from' => TestConstants::BW_NUMBER,
+ 'to' => [TestConstants::BW_NUMBER],
'text' => self::$message_text,
'priority' => self::$message_priority,
'expiration' => self::$expiration
]);
[$data, $status_code] = self::$apiInstance->createMessageWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$message_request
);
@@ -131,7 +125,7 @@ public function testCreateMessage()
public function testListMessages()
{
[$data, $status_code] = self::$apiInstance->listMessagesWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
diff --git a/tests/Unit/Api/MultiChannelApiTest.php b/tests/Unit/Api/MultiChannelApiTest.php
index 219744e6..58d89f05 100644
--- a/tests/Unit/Api/MultiChannelApiTest.php
+++ b/tests/Unit/Api/MultiChannelApiTest.php
@@ -37,6 +37,7 @@
use Bandwidth\Model\MultiChannelMessageResponseData;
use Bandwidth\Model\PriorityEnum;
use Bandwidth\Model\SmsMessageContent;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -51,10 +52,6 @@ class MultiChannelApiTest extends TestCase
{
private static MultiChannelApi $apiInstance;
- private static string $account_id;
- private static string $bw_number;
- private static string $user_number;
- private static string $messaging_application_id;
private static \DateTime $expiration;
/**
@@ -69,11 +66,6 @@ public static function setUpBeforeClass(): void
self::$apiInstance = new MultiChannelApi(config: $config);
- self::$account_id = getenv("BW_ACCOUNT_ID");
- self::$bw_number = getenv("BW_NUMBER");
- self::$user_number = getenv("USER_NUMBER");
- self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID");
-
self::$expiration = (new \DateTime('@' . strtotime('+1 minute')))
->setTimezone(new \DateTimeZone('UTC'));
}
@@ -87,14 +79,14 @@ public static function setUpBeforeClass(): void
public function testCreateMultiChannelMessage()
{
$channel_list_object = new MultiChannelChannelListSMSObject([
- 'from' => self::$bw_number,
- 'application_id' => self::$messaging_application_id,
+ 'from' => TestConstants::BW_NUMBER,
+ 'application_id' => TestConstants::MESSAGING_APPLICATION_ID,
'channel' => MultiChannelMessageChannelEnum::SMS,
'content' => new SmsMessageContent(['text' => 'Hello World!'])
]);
$multi_channel_message_request = new MultiChannelMessageRequest([
- 'to' => self::$user_number,
+ 'to' => TestConstants::USER_NUMBER,
'tag' => 'tag',
'priority' => PriorityEnum::HIGH,
'expiration' => self::$expiration,
@@ -102,7 +94,7 @@ public function testCreateMultiChannelMessage()
]);
[$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$multi_channel_message_request
);
diff --git a/tests/Unit/Api/PhoneNumberLookupApiTest.php b/tests/Unit/Api/PhoneNumberLookupApiTest.php
index 95f8c043..c799e69f 100644
--- a/tests/Unit/Api/PhoneNumberLookupApiTest.php
+++ b/tests/Unit/Api/PhoneNumberLookupApiTest.php
@@ -43,6 +43,7 @@
use Bandwidth\Model\LinkSchema;
use Bandwidth\Model\LookupResult;
use Bandwidth\Model\SyncLookupRequest;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -57,7 +58,6 @@ class PhoneNumberLookupApiTest extends TestCase
{
private static PhoneNumberLookupApi $apiInstance;
- private static string $account_id;
private static string $request_id = '123e4567-e89b-12d3-a456-426614174000';
@@ -75,8 +75,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new PhoneNumberLookupApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
}
/**
@@ -92,7 +90,7 @@ public function testCreateAsyncBulkLookup()
]);
[$data, $status_code] = self::$apiInstance->createAsyncBulkLookupWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$async_lookup_request
);
@@ -124,7 +122,7 @@ public function testCreateSyncLookup()
]);
[$data, $status_code] = self::$apiInstance->createSyncLookupWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$sync_lookup_request
);
@@ -170,7 +168,7 @@ public function testCreateSyncLookup()
public function testGetAsyncBulkLookup()
{
[$data, $status_code] = self::$apiInstance->getAsyncBulkLookupWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$request_id
);
diff --git a/tests/Unit/Api/RecordingsApiTest.php b/tests/Unit/Api/RecordingsApiTest.php
index 8ef4d11c..ab15d130 100644
--- a/tests/Unit/Api/RecordingsApiTest.php
+++ b/tests/Unit/Api/RecordingsApiTest.php
@@ -39,6 +39,7 @@
use Bandwidth\Model\TranscribeRecording;
use Bandwidth\Model\Transcription;
use Bandwidth\Model\UpdateCallRecording;
+use Bandwidth\Test\Unit\TestConstants;
use SplFileObject;
use PHPUnit\Framework\TestCase;
@@ -54,7 +55,6 @@ class RecordingsApiTest extends TestCase
{
private static RecordingsApi $apiInstance;
- private static string $account_id;
private static string $call_id = 'c-1234';
private static string $recording_id = 'r-1234';
@@ -70,8 +70,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new RecordingsApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
}
/**
@@ -83,7 +81,7 @@ public static function setUpBeforeClass(): void
public function testDeleteRecording()
{
[, $status_code] = self::$apiInstance->deleteRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -100,7 +98,7 @@ public function testDeleteRecording()
public function testDeleteRecordingMedia()
{
[, $status_code] = self::$apiInstance->deleteRecordingMediaWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -117,7 +115,7 @@ public function testDeleteRecordingMedia()
public function testDeleteRecordingTranscription()
{
[, $status_code] = self::$apiInstance->deleteRecordingTranscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -136,7 +134,7 @@ public function testDownloadCallRecording()
self::markTestSkipped("Can't set the correct Accept header for Prism");
[$data, $status_code] = self::$apiInstance->downloadCallRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -156,7 +154,7 @@ public function testGetCallRecording()
self::markTestSkipped('Prism Error');
[$data, $status_code] = self::$apiInstance->getCallRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -197,7 +195,7 @@ public function testGetCallRecording()
public function testGetRecordingTranscription()
{
[$data, $status_code] = self::$apiInstance->getRecordingTranscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id
);
@@ -227,7 +225,7 @@ public function testGetRecordingTranscription()
public function testListAccountCallRecordings()
{
[$data, $status_code] = self::$apiInstance->listAccountCallRecordingsWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
@@ -266,7 +264,7 @@ public function testListAccountCallRecordings()
public function testListCallRecordings()
{
[$data, $status_code] = self::$apiInstance->listCallRecordingsWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id
);
@@ -310,7 +308,7 @@ public function testTranscribeCallRecording()
]);
[, $status_code] = self::$apiInstance->transcribeCallRecordingWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$recording_id,
$transcribe_recording
@@ -332,7 +330,7 @@ public function testUpdateCallRecordingState()
]);
[, $status_code] = self::$apiInstance->updateCallRecordingStateWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
$update_call_recording
);
diff --git a/tests/Unit/Api/StatisticsApiTest.php b/tests/Unit/Api/StatisticsApiTest.php
index bc158a38..198921a0 100644
--- a/tests/Unit/Api/StatisticsApiTest.php
+++ b/tests/Unit/Api/StatisticsApiTest.php
@@ -30,6 +30,7 @@
use Bandwidth\Configuration;
use Bandwidth\Api\StatisticsApi;
use Bandwidth\Model\AccountStatistics;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -44,7 +45,6 @@ class StatisticsApiTest extends TestCase
{
private static StatisticsApi $apiInstance;
- private static string $account_id;
/**
* Setup before running any test cases
@@ -57,8 +57,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new StatisticsApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
}
/**
@@ -70,7 +68,7 @@ public static function setUpBeforeClass(): void
public function testGetStatistics()
{
[$data, $status_code] = self::$apiInstance->getStatisticsWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
diff --git a/tests/Unit/Api/TollFreeVerificationApiTest.php b/tests/Unit/Api/TollFreeVerificationApiTest.php
index b4cea257..2b9f689a 100644
--- a/tests/Unit/Api/TollFreeVerificationApiTest.php
+++ b/tests/Unit/Api/TollFreeVerificationApiTest.php
@@ -47,6 +47,7 @@
use Bandwidth\Model\WebhookSubscriptionRequestSchema;
use Bandwidth\Model\WebhookSubscriptionsListBody;
use Bandwidth\Model\WebhookSubscriptionTypeEnum;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -61,7 +62,6 @@ class TollFreeVerificationApiTest extends TestCase
{
private static TollFreeVerificationApi $apiInstance;
- private static string $account_id;
private static string $phone_number = '+18005551234';
private static string $subscription_id = 'test-id-1234';
@@ -79,8 +79,6 @@ public static function setUpBeforeClass(): void
self::$apiInstance = new TollFreeVerificationApi(config: $config);
- self::$account_id = getenv("BW_ACCOUNT_ID");
-
self::$webhook_subscription_request_schema = new WebhookSubscriptionRequestSchema([
'basic_authentication' => new TfvBasicAuthentication([
'username' => 'username',
@@ -100,7 +98,7 @@ public static function setUpBeforeClass(): void
public function testCreateWebhookSubscription()
{
[$data, $status_code] = self::$apiInstance->createWebhookSubscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$webhook_subscription_request_schema
);
@@ -126,7 +124,7 @@ public function testCreateWebhookSubscription()
public function testDeleteVerificationRequest()
{
[, $status_code] = self::$apiInstance->deleteVerificationRequestWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$phone_number
);
@@ -142,7 +140,7 @@ public function testDeleteVerificationRequest()
public function testDeleteWebhookSubscription()
{
[, $status_code] = self::$apiInstance->deleteWebhookSubscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$subscription_id
);
@@ -158,7 +156,7 @@ public function testDeleteWebhookSubscription()
public function testGetTollFreeVerificationStatus()
{
[$data, $status_code] = self::$apiInstance->getTollFreeVerificationStatusWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$phone_number
);
@@ -200,7 +198,7 @@ public function testListTollFreeUseCases()
public function testListWebhookSubscriptions()
{
[$data, $status_code] = self::$apiInstance->listWebhookSubscriptionsWithHttpInfo(
- self::$account_id
+ TestConstants::ACCOUNT_ID
);
$this->assertEquals(200, $status_code);
@@ -281,7 +279,7 @@ public function testRequestTollFreeVerification()
]);
[, $status_code] = self::$apiInstance->requestTollFreeVerificationWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
$verification_request
);
@@ -301,7 +299,7 @@ public function testUpdateTollFreeVerificationRequest()
]);
[, $status_code] = self::$apiInstance->updateTollFreeVerificationRequestWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$phone_number,
$tfv_submission_wrapper
);
@@ -318,7 +316,7 @@ public function testUpdateTollFreeVerificationRequest()
public function testUpdateWebhookSubscription()
{
[$data, $status_code] = self::$apiInstance->updateWebhookSubscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$subscription_id,
self::$webhook_subscription_request_schema
);
diff --git a/tests/Unit/Api/TranscriptionsApiTest.php b/tests/Unit/Api/TranscriptionsApiTest.php
index 6036a758..8652fe37 100644
--- a/tests/Unit/Api/TranscriptionsApiTest.php
+++ b/tests/Unit/Api/TranscriptionsApiTest.php
@@ -34,6 +34,7 @@
use Bandwidth\Model\CallTranscriptionMetadata;
use Bandwidth\Model\CallTranscriptionResponse;
use Bandwidth\Model\CallTranscriptionTrackEnum;
+use Bandwidth\Test\Unit\TestConstants;
use PHPUnit\Framework\TestCase;
@@ -48,7 +49,6 @@ class TranscriptionsApiTest extends TestCase
{
private static TranscriptionsApi $apiInstance;
- private static string $account_id;
private static string $call_id = 'c-1234';
private static string $transcription_id = 't-1234';
@@ -64,8 +64,6 @@ public static function setUpBeforeClass(): void
->setHost("http://127.0.0.1:4010");
self::$apiInstance = new TranscriptionsApi(config: $config);
-
- self::$account_id = getenv("BW_ACCOUNT_ID");
}
/**
@@ -77,7 +75,7 @@ public static function setUpBeforeClass(): void
public function testDeleteRealTimeTranscription()
{
[, $status_code] = self::$apiInstance->deleteRealTimeTranscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$transcription_id
);
@@ -95,7 +93,7 @@ public function testDeleteRealTimeTranscription()
public function testGetRealTimeTranscription()
{
[$data, $status_code] = self::$apiInstance->getRealTimeTranscriptionWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id,
self::$transcription_id
);
@@ -125,7 +123,7 @@ public function testGetRealTimeTranscription()
public function testListRealTimeTranscriptions()
{
[$data, $status_code] = self::$apiInstance->listRealTimeTranscriptionsWithHttpInfo(
- self::$account_id,
+ TestConstants::ACCOUNT_ID,
self::$call_id
);
diff --git a/tests/Unit/TestConstants.php b/tests/Unit/TestConstants.php
new file mode 100644
index 00000000..0728df0d
--- /dev/null
+++ b/tests/Unit/TestConstants.php
@@ -0,0 +1,22 @@
+