Skip to content

Commit 277d2cb

Browse files
committed
[CC-2672] Cleanup failing integration tests.
1 parent cfe962c commit 277d2cb

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

test/BasePaymentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public function createCharge($amount = 100.0): Charge
292292
*/
293293
public static function generateRandomId(): string
294294
{
295-
return str_replace('.', '', microtime(true));
295+
return str_replace('.', '', random_int(0, 99999999));
296296
}
297297

298298
/**

test/integration/PaymentTypes/PaylaterInstallmentTest.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
namespace UnzerSDK\test\integration\PaymentTypes;
1414

1515
use UnzerSDK\Constants\CustomerTypes;
16+
use UnzerSDK\Constants\ShippingTypes;
1617
use UnzerSDK\Exceptions\UnzerApiException;
1718
use UnzerSDK\Resources\Customer;
1819
use UnzerSDK\Resources\CustomerFactory;
1920
use UnzerSDK\Resources\EmbeddedResources\Address;
20-
use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlansQuery;
2121
use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlan;
22+
use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlansQuery;
2223
use UnzerSDK\Resources\PaymentTypes\PaylaterInstallment;
2324
use UnzerSDK\Resources\TransactionTypes\Authorization;
2425
use UnzerSDK\Resources\TransactionTypes\Cancellation;
2526
use UnzerSDK\Resources\TransactionTypes\Charge;
2627
use UnzerSDK\test\BaseIntegrationTest;
27-
2828
use function count;
2929

3030
class PaylaterInstallmentTest extends BaseIntegrationTest
@@ -232,7 +232,7 @@ protected function createAuthorizeTransaction(): Authorization
232232
$ins = new PaylaterInstallment($plans->getId(), $selectedPlan->getNumberOfRates(), 'DE89370400440532013000', 'DE', 'Peter Mustermann');
233233
$this->unzer->createPaymentType($ins);
234234

235-
$customer = $this->getCustomer()->setFirstname('Peter')->setLastname('Mustermann');
235+
$customer = $this->getCustomer();
236236
$basket = $this->createBasket();
237237

238238
$authorization = new Authorization(99.99, 'EUR', self::RETURN_URL);
@@ -244,17 +244,22 @@ protected function createAuthorizeTransaction(): Authorization
244244
*/
245245
public function getCustomer(): Customer
246246
{
247-
$customer = CustomerFactory::createCustomer('Manuel', 'Weißmann');
247+
$customer = CustomerFactory::createCustomer('Maximilian', 'Mustermann');
248248
$address = (new Address())
249-
->setStreet('Hugo-Junckers-Straße 3')
249+
->setName('Maximilian Mustermann')
250+
->setStreet('Hugo-Junkers-Str. 3')
250251
->setState('DE-BO')
251252
->setZip('60386')
252253
->setCity('Frankfurt am Main')
253254
->setCountry('DE');
254255
$customer
256+
->setSalutation('mr')
255257
->setBillingAddress($address)
256-
->setBirthDate('2000-12-12')
257-
->setEmail('[email protected]');
258+
->setCustomerId('c' . substr(self::generateRandomId(), 0, 7))
259+
->setShippingAddress((clone $address)->setShippingType(ShippingTypes::EQUALS_BILLING))
260+
->setLanguage('de')
261+
->setBirthDate('1974-10-02')
262+
->setEmail('[email protected]');
258263

259264
return $customer;
260265
}

0 commit comments

Comments
 (0)