Add test factories and traits for integration tests

- Add ProductFactory, OrderFactory, and CouponFactory
- Add CreateTestOrders and CreateTestProducts traits for reusable test setup
- Add ProductPresets and DiscountPresets fixtures
- Implement existence checks to prevent duplicate product/coupon creation
This commit is contained in:
carmenmaymo 2025-06-23 15:03:31 +02:00
parent b6725a5449
commit 0284e38e0c
No known key found for this signature in database
GPG key ID: 6023F686B0F3102E
10 changed files with 727 additions and 98 deletions

View file

@ -25,13 +25,8 @@ class VaultingSubscriptionsTest extends IntegrationMockedTestCase
{
parent::setUp();
// Common mock setup
$this->mockPaymentTokensEndpoint = \Mockery::mock(PaymentTokensEndpoint::class);
// Create customer and default product that can be reused
$this->customer_id = $this->createCustomerIfNotExists();
$this->default_product_id = $this->createAProductIfNotProvided();
}
}
/**
* Sets up a test container with common mocks
@ -172,7 +167,7 @@ class VaultingSubscriptionsTest extends IntegrationMockedTestCase
{
return [
'PayPal Gateway' => [PayPalGateway::ID],
'Credit Card Gateway' => [CreditCardGateway::ID]
//'Credit Card Gateway' => [CreditCardGateway::ID]
];
}