Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- cron: "0 4 * * *"
pull_request:
paths:
- "spec/smoke/*"
- "tests/Smoke/**"
- ".github/workflows/test-smoke.yml"

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion tests/Smoke/CallsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/Smoke/ConferencesApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/Smoke/RecordingsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @package Bandwidth
*/

namespace Bandwidth\Test\Utils;
namespace Bandwidth\Test\Smoke\Utils;

use Bandwidth\Api\CallsApi;
use Bandwidth\Model\CallStateEnum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @package Bandwidth
*/

namespace Bandwidth\Test\Utils;
namespace Bandwidth\Test\Smoke\Utils;

use GuzzleHttp\Client;

Expand Down
40 changes: 14 additions & 26 deletions tests/Unit/Api/CallsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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");
}

/**
Expand All @@ -101,27 +89,27 @@ 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,
'callback_timeout' => self::$callback_timeout
]);

[$data, $status_code] = self::$apiInstance->createCallWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
$create_call
);

Expand Down Expand Up @@ -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
);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -234,7 +222,7 @@ public function testUpdateCall()
]);

[, $status_code] = self::$apiInstance->updateCallWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
self::$call_id,
$update_call
);
Expand All @@ -253,7 +241,7 @@ public function testUpdateCallBxml()
$update_call_bxml = '<Response><Hangup/></Response>';

[, $status_code] = self::$apiInstance->updateCallBxmlWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
self::$call_id,
$update_call_bxml
);
Expand Down
28 changes: 12 additions & 16 deletions tests/Unit/Api/ConferencesApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -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");
}

/**
Expand All @@ -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
);
Expand All @@ -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
);

Expand All @@ -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
);
Expand All @@ -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
);
Expand Down Expand Up @@ -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
);

Expand Down Expand Up @@ -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
);

Expand All @@ -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
);
Expand All @@ -264,7 +260,7 @@ public function testUpdateConferenceBxml()
$update_conference_bxml = '<Response><Hangup/></Response>';

[, $status_code] = self::$apiInstance->updateConferenceBxmlWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
self::$conference_id,
$update_conference_bxml
);
Expand All @@ -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
Expand Down
14 changes: 6 additions & 8 deletions tests/Unit/Api/EndpointsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence>Hello</SpeakSentence></Bxml>';
Expand All @@ -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");
}

/**
Expand All @@ -88,7 +86,7 @@ public function testCreateEndpoint()
]);

[$data, $status_code] = self::$apiInstance->createEndpointWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
$endpoint_body
);

Expand Down Expand Up @@ -116,7 +114,7 @@ public function testCreateEndpoint()
public function testDeleteEndpoint()
{
[, $status_code] = self::$apiInstance->deleteEndpointWithHttpInfo(
self::$account_id,
TestConstants::ACCOUNT_ID,
self::$endpoint_id
);

Expand All @@ -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
);

Expand All @@ -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);
Expand All @@ -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
);
Expand Down
Loading
Loading