Skip to content

Commit

Permalink
Merge pull request #268 from EasyPost/fix_report_params_payload_sleep
Browse files Browse the repository at this point in the history
fix: event type param, payload test sleep
  • Loading branch information
Justintime50 authored Feb 16, 2023
2 parents 4818cc0 + 274265a commit 107596b
Show file tree
Hide file tree
Showing 9 changed files with 414 additions and 473 deletions.
3 changes: 2 additions & 1 deletion lib/EasyPost/Service/ReportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function all($params = null)
$type = $params['type'];
self::validate($params);
$url = self::reportUrl($type);
unset($params['type']);
$response = Requestor::request($this->client, 'get', $url, $params);

return InternalUtil::convertToEasyPostObject($this->client, $response);
Expand Down Expand Up @@ -86,6 +87,6 @@ private function reportUrl($type)
$type = str_replace('_report', '', $type);
$name = urlencode($type);

return "/reports/{$name}/";
return "/reports/{$name}";
}
}
16 changes: 8 additions & 8 deletions test/EasyPost/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public function testReceiveNoInput()
*/
public function testRetrieveAllPayloads()
{
$cassetteName = 'batches/retrieve_all_payloads.yml';
$cassetteName = 'events/retrieve_all_payloads.yml';
$testRequiresWait = true ? file_exists(dirname(__DIR__, 1) . "/cassettes/$cassetteName") === false : false;

TestUtil::setupCassette('events/retrieve_all_payloads.yml');
TestUtil::setupCassette($cassetteName);

// Create a webhook to receive the event.
$webhook = self::$client->webhook->create([
Expand Down Expand Up @@ -140,10 +140,10 @@ public function testRetrieveAllPayloads()
*/
public function testRetrievePayload()
{
$cassetteName = 'batches/retrieve_all_payloads.yml';
$cassetteName = 'events/retrieve_payload.yml';
$testRequiresWait = true ? file_exists(dirname(__DIR__, 1) . "/cassettes/$cassetteName") === false : false;

TestUtil::setupCassette('events/retrieve_payload.yml');
TestUtil::setupCassette($cassetteName);

// Create a webhook to receive the event.
$webhook = self::$client->webhook->create([
Expand All @@ -166,10 +166,10 @@ public function testRetrievePayload()

// Payload does not exist due to queueing, so this will throw en exception.
try {
self::$client->event->retrievePayload(
$event->id,
'payload_11111111111111111111111111111111',
);
self::$client->event->retrievePayload(
$event->id,
'payload_11111111111111111111111111111111',
);
} catch (EasyPostException $error) {
$this->assertEquals(404, $error->getHttpStatus());
}
Expand Down
237 changes: 121 additions & 116 deletions test/cassettes/events/retrieve_all_payloads.yml

Large diffs are not rendered by default.

317 changes: 123 additions & 194 deletions test/cassettes/events/retrieve_payload.yml

Large diffs are not rendered by default.

53 changes: 27 additions & 26 deletions test/cassettes/reports/all.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 26 additions & 25 deletions test/cassettes/reports/createCustomAdditionalColumnReport.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 28 additions & 27 deletions test/cassettes/reports/createCustomColumnReport.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 107596b

Please sign in to comment.