Skip to content

DX-2262 Update messaging media id to be unique #40

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

Merged
merged 1 commit into from
Oct 13, 2021
Merged
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: 7 additions & 7 deletions tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ public function testCreateMessageInvalidPhoneNumber() {

public function testUploadDownloadMedia() {
//constants

$mediaFileName = "php-monitoring";
$mediaFile = "12345"; //todo: confirm binary string?
$mediaId = "text-media-id-" . uniqid();
$content = "Hello world";

//media upload
$this->bandwidthClient->getMessaging()->getClient()->uploadMedia(getenv("BW_ACCOUNT_ID"), $mediaFileName, $mediaFile);
$this->bandwidthClient->getMessaging()->getClient()->uploadMedia(getenv("BW_ACCOUNT_ID"), $mediaId, $content);

//media download
$downloadedMediaFile = $this->bandwidthClient->getMessaging()->getClient()->getMedia(getenv("BW_ACCOUNT_ID"), $mediaFileName)->getResult();
$downloadedContent = $this->bandwidthClient->getMessaging()->getClient()->getMedia(getenv("BW_ACCOUNT_ID"), $mediaId)->getResult();

//media delete
$deleteMedaiFile = $this->bandwidthClient->getMessaging()->getClient()->deleteMedia(getenv("BW_ACCOUNT_ID"), $mediaFileName);
$this->bandwidthClient->getMessaging()->getClient()->deleteMedia(getenv("BW_ACCOUNT_ID"), $mediaId);

//validate that response is the same
$this->assertEquals($downloadedMediaFile, $mediaFile);
$this->assertEquals($downloadedContent, $content);
}

public function testCreateCallAndGetCallState() {
Expand Down