From e1522b190b45d4903bdfe10aaee05aeb2cb291c4 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:27:47 -0700 Subject: [PATCH] fix: better test error handling --- test/EasyPost/AddressTest.php | 5 ++++- test/EasyPost/EventTest.php | 5 ++++- test/EasyPost/InsuranceTest.php | 5 ++++- test/EasyPost/PickupTest.php | 5 ++++- test/EasyPost/ReferralCustomerTest.php | 5 ++++- test/EasyPost/RefundTest.php | 5 ++++- test/EasyPost/ReportTest.php | 5 ++++- test/EasyPost/ScanFormTest.php | 5 ++++- test/EasyPost/ShipmentTest.php | 5 ++++- test/EasyPost/TrackerTest.php | 5 ++++- 10 files changed, 40 insertions(+), 10 deletions(-) diff --git a/test/EasyPost/AddressTest.php b/test/EasyPost/AddressTest.php index 320b3848..70c31273 100644 --- a/test/EasyPost/AddressTest.php +++ b/test/EasyPost/AddressTest.php @@ -6,6 +6,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\Api\ApiException; use EasyPost\Exception\General\EndOfPaginationException; +use Exception; class AddressTest extends \PHPUnit\Framework\TestCase { @@ -156,8 +157,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/EventTest.php b/test/EasyPost/EventTest.php index 00e6c5ef..cd31604c 100644 --- a/test/EasyPost/EventTest.php +++ b/test/EasyPost/EventTest.php @@ -8,6 +8,7 @@ use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Payload; use EasyPost\Util\Util; +use Exception; class EventTest extends \PHPUnit\Framework\TestCase { @@ -66,8 +67,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/InsuranceTest.php b/test/EasyPost/InsuranceTest.php index fa4f8bce..8f0234ff 100644 --- a/test/EasyPost/InsuranceTest.php +++ b/test/EasyPost/InsuranceTest.php @@ -5,6 +5,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Insurance; +use Exception; class InsuranceTest extends \PHPUnit\Framework\TestCase { @@ -102,8 +103,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } } diff --git a/test/EasyPost/PickupTest.php b/test/EasyPost/PickupTest.php index c1a12bd9..a4a31115 100644 --- a/test/EasyPost/PickupTest.php +++ b/test/EasyPost/PickupTest.php @@ -6,6 +6,7 @@ use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Exception\General\FilteringException; use EasyPost\Pickup; +use Exception; class PickupTest extends \PHPUnit\Framework\TestCase { @@ -102,8 +103,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/ReferralCustomerTest.php b/test/EasyPost/ReferralCustomerTest.php index 8aebf7e1..634c2dd5 100644 --- a/test/EasyPost/ReferralCustomerTest.php +++ b/test/EasyPost/ReferralCustomerTest.php @@ -5,6 +5,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\User; +use Exception; class ReferralCustomerTest extends \PHPUnit\Framework\TestCase { @@ -86,8 +87,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/RefundTest.php b/test/EasyPost/RefundTest.php index 0922ea31..0ea790db 100644 --- a/test/EasyPost/RefundTest.php +++ b/test/EasyPost/RefundTest.php @@ -5,6 +5,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Refund; +use Exception; class RefundTest extends \PHPUnit\Framework\TestCase { @@ -86,8 +87,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/ReportTest.php b/test/EasyPost/ReportTest.php index 6f956b62..a4902e45 100644 --- a/test/EasyPost/ReportTest.php +++ b/test/EasyPost/ReportTest.php @@ -6,6 +6,7 @@ use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Exception\General\MissingParameterException; use EasyPost\Report; +use Exception; class ReportTest extends \PHPUnit\Framework\TestCase { @@ -143,8 +144,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/ScanFormTest.php b/test/EasyPost/ScanFormTest.php index 5836ce75..401ca744 100644 --- a/test/EasyPost/ScanFormTest.php +++ b/test/EasyPost/ScanFormTest.php @@ -5,6 +5,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\ScanForm; +use Exception; class ScanFormTest extends \PHPUnit\Framework\TestCase { @@ -99,8 +100,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } } diff --git a/test/EasyPost/ShipmentTest.php b/test/EasyPost/ShipmentTest.php index 638826ed..7200b129 100644 --- a/test/EasyPost/ShipmentTest.php +++ b/test/EasyPost/ShipmentTest.php @@ -9,6 +9,7 @@ use EasyPost\Rate; use EasyPost\Shipment; use EasyPost\Util\Util; +use Exception; class ShipmentTest extends \PHPUnit\Framework\TestCase { @@ -100,8 +101,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); $this->assertNotNull($nextPage['_paramsss']); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } } diff --git a/test/EasyPost/TrackerTest.php b/test/EasyPost/TrackerTest.php index 767fecba..582ca7d9 100644 --- a/test/EasyPost/TrackerTest.php +++ b/test/EasyPost/TrackerTest.php @@ -5,6 +5,7 @@ use EasyPost\EasyPostClient; use EasyPost\Exception\General\EndOfPaginationException; use EasyPost\Tracker; +use Exception; class TrackerTest extends \PHPUnit\Framework\TestCase { @@ -112,8 +113,10 @@ public function testGetNextPage() $this->assertNotEquals($firstIdOfFirstPage, $secondIdOfSecondPage); } catch (EndOfPaginationException $error) { - error_log('Test failed intentionally', 3, '/dev/stdout'); + // There's no second page, that's not a failure $this->assertTrue(true); + } catch (Exception $error) { + throw $error; } }