Skip to content

Commit

Permalink
Update messaging media id to be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
hamermike committed Oct 12, 2021
1 parent 3633252 commit aeb1789
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 aeb1789

Please sign in to comment.