diff --git a/tests/Unit/TestPaymentGateway.php b/tests/Unit/TestPaymentGateway.php index 18852e3..cc20f1a 100644 --- a/tests/Unit/TestPaymentGateway.php +++ b/tests/Unit/TestPaymentGateway.php @@ -8,7 +8,9 @@ use Payavel\Checkout\Models\PaymentTransaction; use Payavel\Checkout\Models\Wallet; use Payavel\Checkout\PaymentResponse; +use Payavel\Checkout\Tests\AlternativePaymentResponse; use Payavel\Checkout\Tests\GatewayTestCase; +use Payavel\Checkout\Tests\TestPaymentResponse; use Payavel\Checkout\Tests\User; class TestPaymentGateway extends GatewayTestCase @@ -24,7 +26,7 @@ public function set_provider_and_merchant_fluently() /** @test */ public function setting_invalid_driver_throws_exception() { - config(['payment.defaults.driver' => 'fake']); + config(['payment.defaults.driver' => 'invalid']); $this->expectException(Exception::class); $this->expectExceptionMessage('Invalid checkout driver provided.'); @@ -38,7 +40,7 @@ public function setting_invalid_provider_throws_exception() $this->expectException(Exception::class); $this->expectExceptionMessage('Invalid checkout provider.'); - Payment::setProvider('fake'); + Payment::setProvider('invalid'); } /** @test */ @@ -47,7 +49,7 @@ public function setting_invalid_merchant_throws_exception() $this->expectException(Exception::class); $this->expectExceptionMessage('Invalid checkout merchant.'); - Payment::setMerchant('faker'); + Payment::setMerchant('invalid'); } /** @test */ @@ -60,6 +62,18 @@ public function setting_incompatible_merchant_provider_throws_exception() Payment::authorize([]); } + /** @test */ + public function resetting_payment_service_to_default_configuration() + { + Payment::provider('alternative')->merchant('alternate'); + + $this->assertEquals(AlternativePaymentResponse::class, get_class(Payment::authorize([]))); + + Payment::reset(); + + $this->assertEquals(TestPaymentResponse::class, get_class(Payment::authorize([]))); + } + /** @test */ public function payment_service_throws_exception_when_test_mode_gateway_does_not_exist() {