Skip to content

Commit

Permalink
Merge pull request #40 from Bandwidth/task/update-media-id-guid
Browse files Browse the repository at this point in the history
DX-2262 Update messaging media id to be unique
  • Loading branch information
hamermike authored Oct 13, 2021
2 parents 3633252 + aeb1789 commit 8e3c680
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit 8e3c680

Please sign in to comment.