Skip to content

Commit

Permalink
Merge pull request #212 from EasyPost/fix_extra_imports
Browse files Browse the repository at this point in the history
fix: extra imports and add regression test
  • Loading branch information
Justintime50 authored Aug 20, 2022
2 parents a767cc5 + 434bd79 commit 40f96d2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v5.5.1 (2022-08-20)

- Removes some extra imports that no longer exist causing errors when importing this library. Adds a regression test to protect against this in the future.

## v5.5.0 (2022-08-02)

- Adds Carbon Offset support
Expand Down
82 changes: 40 additions & 42 deletions lib/easypost.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

// Require this file if you're not using composer's vendor/autoload
// `require` this file if you're not using composer's vendor/autoload

// Required PHP extensions
if (!function_exists('curl_init')) {
Expand All @@ -11,48 +11,46 @@
}

// Config and Utilities
require(dirname(__FILE__) . '/EasyPost/EasyPost.php');
require(dirname(__FILE__) . '/EasyPost/Util.php');
require(dirname(__FILE__) . '/EasyPost/Error.php');
require_once(dirname(__FILE__) . '/EasyPost/EasyPost.php');
require_once(dirname(__FILE__) . '/EasyPost/Util.php');
require_once(dirname(__FILE__) . '/EasyPost/Error.php');

// Guts
require(dirname(__FILE__) . '/EasyPost/EasyPostObject.php');
require(dirname(__FILE__) . '/EasyPost/EasypostResource.php');
require(dirname(__FILE__) . '/EasyPost/Requestor.php');
require_once(dirname(__FILE__) . '/EasyPost/EasyPostObject.php');
require_once(dirname(__FILE__) . '/EasyPost/EasypostResource.php');
require_once(dirname(__FILE__) . '/EasyPost/Requestor.php');

// API Resources
require(dirname(__FILE__) . '/EasyPost/Address.php');
require(dirname(__FILE__) . '/EasyPost/Batch.php');
require(dirname(__FILE__) . '/EasyPost/Brand.php');
require(dirname(__FILE__) . '/EasyPost/CarbonOffset.php');
require(dirname(__FILE__) . '/EasyPost/CarrierAccount.php');
require(dirname(__FILE__) . '/EasyPost/CarrierDetail.php');
require(dirname(__FILE__) . '/EasyPost/CreditCard.php');
require(dirname(__FILE__) . '/EasyPost/CustomsInfo.php');
require(dirname(__FILE__) . '/EasyPost/CustomsItem.php');
require(dirname(__FILE__) . '/EasyPost/Beta/EndShipper.php');
require(dirname(__FILE__) . '/EasyPost/Event.php');
require(dirname(__FILE__) . '/EasyPost/Fee.php');
require(dirname(__FILE__) . '/EasyPost/FieldError.php');
require(dirname(__FILE__) . '/EasyPost/Insurance.php');
require(dirname(__FILE__) . '/EasyPost/Message.php');
require(dirname(__FILE__) . '/EasyPost/Order.php');
require(dirname(__FILE__) . '/EasyPost/Parcel.php');
require(dirname(__FILE__) . '/EasyPost/PaymentMethod.php');
require(dirname(__FILE__) . '/EasyPost/Pickup.php');
require(dirname(__FILE__) . '/EasyPost/PickupRate.php');
require(dirname(__FILE__) . '/EasyPost/PostageLabel.php');
require(dirname(__FILE__) . '/EasyPost/Rate.php');
require(dirname(__FILE__) . '/EasyPost/Refund.php');
require(dirname(__FILE__) . '/EasyPost/Report.php');
require(dirname(__FILE__) . '/EasyPost/ScanForm.php');
require(dirname(__FILE__) . '/EasyPost/Shipment.php');
require(dirname(__FILE__) . '/EasyPost/TaxIdentifier.php');
require(dirname(__FILE__) . '/EasyPost/Tracker.php');
require(dirname(__FILE__) . '/EasyPost/TrackingDetail.php');
require(dirname(__FILE__) . '/EasyPost/TrackingLocation.php');
require(dirname(__FILE__) . '/EasyPost/User.php');
require(dirname(__FILE__) . '/EasyPost/Verification.php');
require(dirname(__FILE__) . '/EasyPost/VerificationDetails.php');
require(dirname(__FILE__) . '/EasyPost/Verifications.php');
require(dirname(__FILE__) . '/EasyPost/Webhook.php');
require_once(dirname(__FILE__) . '/EasyPost/Address.php');
require_once(dirname(__FILE__) . '/EasyPost/Batch.php');
require_once(dirname(__FILE__) . '/EasyPost/Brand.php');
require_once(dirname(__FILE__) . '/EasyPost/CarbonOffset.php');
require_once(dirname(__FILE__) . '/EasyPost/CarrierAccount.php');
require_once(dirname(__FILE__) . '/EasyPost/CarrierDetail.php');
require_once(dirname(__FILE__) . '/EasyPost/CustomsInfo.php');
require_once(dirname(__FILE__) . '/EasyPost/CustomsItem.php');
require_once(dirname(__FILE__) . '/EasyPost/Beta/EndShipper.php');
require_once(dirname(__FILE__) . '/EasyPost/Event.php');
require_once(dirname(__FILE__) . '/EasyPost/Fee.php');
require_once(dirname(__FILE__) . '/EasyPost/FieldError.php');
require_once(dirname(__FILE__) . '/EasyPost/Insurance.php');
require_once(dirname(__FILE__) . '/EasyPost/Message.php');
require_once(dirname(__FILE__) . '/EasyPost/Order.php');
require_once(dirname(__FILE__) . '/EasyPost/Parcel.php');
require_once(dirname(__FILE__) . '/EasyPost/Pickup.php');
require_once(dirname(__FILE__) . '/EasyPost/PickupRate.php');
require_once(dirname(__FILE__) . '/EasyPost/PostageLabel.php');
require_once(dirname(__FILE__) . '/EasyPost/Rate.php');
require_once(dirname(__FILE__) . '/EasyPost/Refund.php');
require_once(dirname(__FILE__) . '/EasyPost/Report.php');
require_once(dirname(__FILE__) . '/EasyPost/ScanForm.php');
require_once(dirname(__FILE__) . '/EasyPost/Shipment.php');
require_once(dirname(__FILE__) . '/EasyPost/TaxIdentifier.php');
require_once(dirname(__FILE__) . '/EasyPost/Tracker.php');
require_once(dirname(__FILE__) . '/EasyPost/TrackingDetail.php');
require_once(dirname(__FILE__) . '/EasyPost/TrackingLocation.php');
require_once(dirname(__FILE__) . '/EasyPost/User.php');
require_once(dirname(__FILE__) . '/EasyPost/Verification.php');
require_once(dirname(__FILE__) . '/EasyPost/VerificationDetails.php');
require_once(dirname(__FILE__) . '/EasyPost/Verifications.php');
require_once(dirname(__FILE__) . '/EasyPost/Webhook.php');
19 changes: 19 additions & 0 deletions test/EasyPost/RequireTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace EasyPost\Test;

require 'lib/easypost.php';

class RequireTest extends \PHPUnit\Framework\TestCase
{
/**
* Tests that no errors are thrown when we import the library without using the autoloader.
* Things like missing or extra imports should be caught by this. The actual assertion here
* doesn't matter, only that an import/require error isn't thrown.
*/
public function testRequireLibrary()
{
$apiBase = \EasyPost\EasyPost::getApiBase();
$this->assertEquals('https://api.easypost.com/v2', $apiBase);
}
}

0 comments on commit 40f96d2

Please sign in to comment.