Skip to content

Commit

Permalink
fix: better test error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Nov 21, 2023
1 parent 1bb8d93 commit e1522b1
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 10 deletions.
5 changes: 4 additions & 1 deletion test/EasyPost/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\Payload;
use EasyPost\Util\Util;
use Exception;

class EventTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/InsuranceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use EasyPost\EasyPostClient;
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\Insurance;
use Exception;

class InsuranceTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}
}
5 changes: 4 additions & 1 deletion test/EasyPost/PickupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/ReferralCustomerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use EasyPost\EasyPostClient;
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\User;
use Exception;

class ReferralCustomerTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/RefundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use EasyPost\EasyPostClient;
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\Refund;
use Exception;

class RefundTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/ReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/ScanFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use EasyPost\EasyPostClient;
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\ScanForm;
use Exception;

class ScanFormTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}
}
5 changes: 4 additions & 1 deletion test/EasyPost/ShipmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use EasyPost\Rate;
use EasyPost\Shipment;
use EasyPost\Util\Util;
use Exception;

class ShipmentTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}

Expand Down
5 changes: 4 additions & 1 deletion test/EasyPost/TrackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use EasyPost\EasyPostClient;
use EasyPost\Exception\General\EndOfPaginationException;
use EasyPost\Tracker;
use Exception;

class TrackerTest extends \PHPUnit\Framework\TestCase
{
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit e1522b1

Please sign in to comment.