update tests
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Payments;
|
||||
|
||||
use App\Services\ApplicationUrlService;
|
||||
use App\Services\Payments\PaypalPaymentService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -11,6 +12,11 @@ class PaypalPaymentServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private function makeService(): PaypalPaymentService
|
||||
{
|
||||
return new PaypalPaymentService(new ApplicationUrlService());
|
||||
}
|
||||
|
||||
public function test_create_payment_falls_back_to_hosted_when_sdk_missing(): void
|
||||
{
|
||||
DB::table('payments')->insert([
|
||||
@@ -27,7 +33,7 @@ class PaypalPaymentServiceTest extends TestCase
|
||||
'status' => 'Pending',
|
||||
]);
|
||||
|
||||
$service = new PaypalPaymentService();
|
||||
$service = $this->makeService();
|
||||
$result = $service->createPayment(1);
|
||||
|
||||
$this->assertSame('hosted', $result['mode']);
|
||||
@@ -36,7 +42,7 @@ class PaypalPaymentServiceTest extends TestCase
|
||||
|
||||
public function test_execute_payment_throws_when_sdk_missing(): void
|
||||
{
|
||||
$service = new PaypalPaymentService();
|
||||
$service = $this->makeService();
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user