Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run tests in CI/CD #72

Closed
wants to merge 2 commits into from
Closed
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
50 changes: 25 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ jobs:
strategy:
matrix:
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
php-version: [7.4, 8.0, 8.1, 8.2]
php-version: [8.0, 8.1, 8.2, 8.3]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Install Packages
run: composer install
- name: Install Packages
run: composer install

- name: Test
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
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 }}
run: ./vendor/bin/phpunit tests
- name: Test
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_USERNAME: ${{ secrets.BW_USERNAME }}
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
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 }}
run: ./vendor/bin/phpunit tests

- uses: Bandwidth/[email protected]
if: failure() && !github.event.pull_request.draft
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
- uses: Bandwidth/[email protected]
if: failure() && !github.event.pull_request.draft
with:
job-status: ${{ job.status }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ try {

```php

$speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence("Hello!");
$speakSentence->voice("susan");
$speakSentence->locale("en_US");
$speakSentence->gender("female");
$response = new BandwidthLib\Voice\Bxml\Response();
$response->addVerb($speakSentence);
$speakSentence = BandwidthLib\Voice\Bxml\SpeakSentence::make("Hello!")
->voice("susan")
->locale("en_US")
->gender("female");
$response = BandwidthLib\Voice\Bxml\Response::make()
->addVerb($speakSentence);
echo $response->toBxml();
```

Expand Down
42 changes: 28 additions & 14 deletions src/Voice/Bxml/Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace BandwidthLib\Voice\Bxml;

use DOMDocument;
use DOMElement;

require_once "Verb.php";

Expand Down Expand Up @@ -85,119 +86,132 @@ public function __construct(string $targetCall) {
*
* @param string $bridgeCompleteUrl URL to send the bridge complete event to
*/
public function bridgeCompleteUrl(string $bridgeCompleteUrl) {
public function bridgeCompleteUrl(string $bridgeCompleteUrl): Bridge {
$this->bridgeCompleteUrl = $bridgeCompleteUrl;
return $this;
}

/**
* Sets the bridgeCompleteMethod attribute for Bridge
*
* @param string $bridgeCompleteMethod HTTP method to send the bridge complete event
*/
public function bridgeCompleteMethod(string $bridgeCompleteMethod) {
public function bridgeCompleteMethod(string $bridgeCompleteMethod): Bridge {
$this->bridgeCompleteMethod = $bridgeCompleteMethod;
return $this;
}

/**
* Sets the bridgeTargetCompleteUrl attribute for Bridge
*
* @param string $bridgeTargetCompleteUrl URL to send the bridge target complete event to
*/
public function bridgeTargetCompleteUrl(string $bridgeTargetCompleteUrl) {
public function bridgeTargetCompleteUrl(string $bridgeTargetCompleteUrl): Bridge {
$this->bridgeTargetCompleteUrl = $bridgeTargetCompleteUrl;
return $this;
}

/**
* Sets the bridgeTargetCompleteMethod attribute for Bridge
*
* @param string $bridgeTargetCompleteMethod HTTP method to send the bridge target complete event
*/
public function bridgeTargetCompleteMethod(string $bridgeTargetCompleteMethod) {
public function bridgeTargetCompleteMethod(string $bridgeTargetCompleteMethod): Bridge {
$this->bridgeTargetCompleteMethod = $bridgeTargetCompleteMethod;
return $this;
}

/**
* Sets the username attribute for Bridge
*
* @param string $username HTTP basic auth username for sending events
*/
public function username(string $username) {
public function username(string $username): Bridge {
$this->username = $username;
return $this;
}

/**
* Sets the password attribute for Bridge
*
* @param string $password HTTP basic auth password for sending events
*/
public function password(string $password) {
public function password(string $password): Bridge {
$this->password = $password;
return $this;
}

/**
* Sets the tag attribute for Bridge
*
* @param string $tag String to include in events
*/
public function tag(string $tag) {
public function tag(string $tag): Bridge {
$this->tag = $tag;
return $this;
}

/**
* Sets the bridgeCompleteFallbackUrl attribute for Bridge
*
* @param string $bridgeCompleteFallbackUrl Fallback URL for bridge complete callback events
*/
public function bridgeCompleteFallbackUrl(string $bridgeCompleteFallbackUrl) {
public function bridgeCompleteFallbackUrl(string $bridgeCompleteFallbackUrl): Bridge {
$this->bridgeCompleteFallbackUrl = $bridgeCompleteFallbackUrl;
return $this;
}

/**
* Sets the bridgeCompleteFallbackMethod attribute for Bridge
*
* @param string $bridgeCompleteFallbackMethod HTTP method for bridge complete fallback requests
*/
public function bridgeCompleteFallbackMethod(string $bridgeCompleteFallbackMethod) {
public function bridgeCompleteFallbackMethod(string $bridgeCompleteFallbackMethod): Bridge {
$this->bridgeCompleteFallbackMethod = $bridgeCompleteFallbackMethod;
return $this;
}

/**
* Sets the bridgeTargetCompleteFallbackUrl attribute for Bridge
*
* @param string $bridgeTargetCompleteFallbackUrl Fallback URL for bridge target complete callback events
*/
public function bridgeTargetCompleteFallbackUrl(string $bridgeTargetCompleteFallbackUrl) {
public function bridgeTargetCompleteFallbackUrl(string $bridgeTargetCompleteFallbackUrl): Bridge {
$this->bridgeTargetCompleteFallbackUrl = $bridgeTargetCompleteFallbackUrl;
return $this;
}

/**
* Sets the bridgeTargetCompleteFallbackMethod attribute for Bridge
*
* @param string $bridgeTargetCompleteFallbackMethod HTTP method for bridge target complete fallback events
*/
public function bridgeTargetCompleteFallbackMethod(string $bridgeTargetCompleteFallbackMethod) {
public function bridgeTargetCompleteFallbackMethod(string $bridgeTargetCompleteFallbackMethod): Bridge {
$this->bridgeTargetCompleteFallbackMethod = $bridgeTargetCompleteFallbackMethod;
return $this;
}

/**
* Sets the fallbackUsername attribute for Bridge
*
* @param string $fallbackUsername HTTP basic auth username for fallback events
*/
public function fallbackUsername(string $fallbackUsername) {
public function fallbackUsername(string $fallbackUsername): Bridge {
$this->fallbackUsername = $fallbackUsername;
return $this;
}

/**
* Sets the fallbackPassword attribute for Bridge
*
* @param string $fallbackPassword HTTP basic auth password
*/
public function fallbackPassword(string $fallbackPassword) {
public function fallbackPassword(string $fallbackPassword): Bridge {
$this->fallbackPassword = $fallbackPassword;
return $this;
}

public function toBxml(DOMDocument $doc) {
public function toBxml(DOMDocument $doc): DOMElement {
$element = $doc->createElement("Bridge");

$element->appendChild($doc->createTextNode($this->targetCall));
Expand Down
5 changes: 3 additions & 2 deletions src/Voice/Bxml/Bxml.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ public function __construct() {
*
* @param Verb $verb The verb to add to the list
*/
public function addVerb(Verb $verb) {
public function addVerb(Verb $verb): Bxml {
array_push($this->verbs, $verb);
return $this;
}

/**
* Converts the Response class into its BXML representation
*
* @return string The xml representation of the class
*/
public function toBxml() {
public function toBxml(): string {
$ssmlRegex = '/<([a-zA-Z\/\/].*?)>/';
$doc = new DOMDocument('1.0', 'UTF-8');
$bxmlElement = $doc->createElement("Bxml");
Expand Down
Loading
Loading