diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 5c181b41..5e3ee9b2 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -388,9 +388,6 @@ jobs: docker compose exec -T php composer require oxid-esales/apex-theme:dev-b-7.0.x --no-update docker compose exec -T php composer require oxid-esales/oxideshop-demodata-ce:dev-b-7.0.x --no-update docker compose exec -T php composer require twig/twig:v3.8.0 --no-update - - - name: Composer install - run: | docker compose exec -T php composer update --no-interaction - name: Activate theme diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml index 5402daf1..a59ab5ce 100644 --- a/.github/workflows/trigger.yml +++ b/.github/workflows/trigger.yml @@ -3,6 +3,8 @@ name: Trigger on: pull_request: push: + schedule: + - cron: '0 6 * * 1-5' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -24,4 +26,4 @@ jobs: secrets: inherit with: php: '8.1' - mysql: '8.0' \ No newline at end of file + mysql: '8.0' diff --git a/CHANGELOG.md b/CHANGELOG.md index da70da9c..08c8e1d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + ## [2.2.0] - 2024-??-?? ### NEW diff --git a/src/Controller/Admin/ModuleConfiguration.php b/src/Controller/Admin/ModuleConfiguration.php index ef3a2182..bb0a1d96 100644 --- a/src/Controller/Admin/ModuleConfiguration.php +++ b/src/Controller/Admin/ModuleConfiguration.php @@ -183,28 +183,21 @@ public function transferApplePayPaymentProcessingData(): void } } - /** - * @throws GuzzleException - */ public function getApplePayPaymentProcessingKeyExists(): bool { $keyExists = false; $keyId = $this->moduleSettings->getApplePayPaymentKeyId(); if ($this->moduleSettings->getApplePayMerchantCertKey() && $keyId) { try { - $keyExists = $this->getServiceFromContainer(ApiClient::class) - ->requestApplePayPaymentKey($keyId) - ->getStatusCode() - === 200; + $response = $this->getServiceFromContainer(ApiClient::class) + ->requestApplePayPaymentCert($keyId); + if (!$response) { + $this->addErrorTransmittingKey(); + return false; + } + $keyExists = $response->getStatusCode() === 200; } catch (GuzzleException $guzzleException) { - Registry::getUtilsView()->addErrorToDisplay( - oxNew( - UnzerException::class, - $this->translator->translate( - 'OSCUNZER_ERROR_TRANSMITTING_APPLEPAY_PAYMENT_GET_KEY' - ) - ) - ); + $this->addErrorTransmittingKey(); } } return $keyExists; @@ -219,19 +212,15 @@ public function getApplePayPaymentProcessingCertExists(): bool $certId = $this->moduleSettings->getApplePayPaymentCertificateId(); if ($this->moduleSettings->getApplePayMerchantCert() && $certId) { try { - $certExists = $this->getServiceFromContainer(ApiClient::class) - ->requestApplePayPaymentCert($certId) - ->getStatusCode() - === 200; + $response = $this->getServiceFromContainer(ApiClient::class) + ->requestApplePayPaymentCert($certId); + if (!$response) { + $this->addErrorTransmittingCertificate(); + return false; + } + $certExists = $response->getStatusCode() === 200; } catch (GuzzleException $guzzleException) { - Registry::getUtilsView()->addErrorToDisplay( - oxNew( - UnzerException::class, - $this->translator->translate( - 'OSCUNZER_ERROR_TRANSMITTING_APPLEPAY_PAYMENT_GET_CERT' - ) - ) - ); + $this->addErrorTransmittingCertificate(); } } return $certExists; @@ -286,4 +275,28 @@ public function saveConfVars() $this->registerWebhooks(); } } + + private function addErrorTransmittingCertificate(): void + { + Registry::getUtilsView()->addErrorToDisplay( + oxNew( + UnzerException::class, + $this->translator->translate( + 'OSCUNZER_ERROR_TRANSMITTING_APPLEPAY_PAYMENT_GET_CERT' + ) + ) + ); + } + + private function addErrorTransmittingKey(): void + { + Registry::getUtilsView()->addErrorToDisplay( + oxNew( + UnzerException::class, + $this->translator->translate( + 'OSCUNZER_ERROR_TRANSMITTING_APPLEPAY_PAYMENT_GET_KEY' + ) + ) + ); + } } diff --git a/tests/Codeception/Acceptance/AlipayCest.php b/tests/Codeception/Acceptance/AlipayCest.php index 5ba50139..bfb5d6dd 100644 --- a/tests/Codeception/Acceptance/AlipayCest.php +++ b/tests/Codeception/Acceptance/AlipayCest.php @@ -25,7 +25,7 @@ final class AlipayCest extends BaseCest /** * @return string */ - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_alipay']; } @@ -34,28 +34,28 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @group AlipayPaymentTest */ - private function _prepareAlipayTest(AcceptanceTester $I) + private function prepareAlipayTest(AcceptanceTester $I) { - $this->_initializeTest(); - $this->_choosePayment($this->alipayPaymentLabel); - $this->_submitOrder(); + $this->initializeTest(); + $this->choosePayment($this->alipayPaymentLabel); + $this->submitOrder(); } /** * @param AcceptanceTester $I * @group AlipayPaymentTest */ - private function _checkAlipayPayment(int $methodNumber) + private function checkAlipayPayment(int $methodNumber) { - $price = str_replace(',', '.', $this->_getPrice()); + $price = str_replace(',', '.', $this->getPrice()); $alipayClientData = Fixtures::get('alipay_client'); - $alipayPage = new LocalPaymentMethodsSimulatorPage($this->_getAcceptance()); + $alipayPage = new LocalPaymentMethodsSimulatorPage($this->getAcceptance()); $alipayPage->login($alipayClientData['username'], $alipayClientData['password'], $price); $alipayPage->choosePaymentMethod($methodNumber); $alipayPage->paymentSuccessful($price); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } /** @@ -65,8 +65,8 @@ private function _checkAlipayPayment(int $methodNumber) public function checkWalletBalancePaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Alipay Wallet Balance payment works'); - $this->_prepareAlipayTest($I); - $this->_checkAlipayPayment(1); + $this->prepareAlipayTest($I); + $this->checkAlipayPayment(1); } /** @@ -76,8 +76,8 @@ public function checkWalletBalancePaymentWorks(AcceptanceTester $I) public function checkSomeLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Alipay Some LPM payment works'); - $this->_prepareAlipayTest($I); - $this->_checkAlipayPayment(2); + $this->prepareAlipayTest($I); + $this->checkAlipayPayment(2); } /** @@ -87,8 +87,8 @@ public function checkSomeLPMPaymentWorks(AcceptanceTester $I) public function checkAnotherLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Alipay Another LPM Alipay payment works'); - $this->_prepareAlipayTest($I); - $this->_checkAlipayPayment(3); + $this->prepareAlipayTest($I); + $this->checkAlipayPayment(3); } /** @@ -98,7 +98,7 @@ public function checkAnotherLPMPaymentWorks(AcceptanceTester $I) public function checkOneMoreLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Alipay One more LPM Alipay payment works'); - $this->_prepareAlipayTest($I); - $this->_checkAlipayPayment(4); + $this->prepareAlipayTest($I); + $this->checkAlipayPayment(4); } } diff --git a/tests/Codeception/Acceptance/BancontactCest.php b/tests/Codeception/Acceptance/BancontactCest.php index a9ed0e57..530aaaf6 100644 --- a/tests/Codeception/Acceptance/BancontactCest.php +++ b/tests/Codeception/Acceptance/BancontactCest.php @@ -49,7 +49,7 @@ public function _after(AcceptanceTester $I): void ); } - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_bancontact']; } @@ -58,43 +58,43 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @return void */ - private function _prepareBancontactTest(AcceptanceTester $I) + private function prepareBancontactTest(AcceptanceTester $I) { - $this->_initializeTest(); + $this->initializeTest(); - $this->_choosePayment($this->bancontactLabel); - $this->_submitOrder(); + $this->choosePayment($this->bancontactLabel); + $this->submitOrder(); } /** * @param string $name Fixtures name * @return void */ - private function _submitBancontactPayment(string $name) + private function submitBancontactPayment(string $name) { - $price = str_replace(',', '.', $this->_getPrice()); + $price = str_replace(',', '.', $this->getPrice()); $fixtures = Fixtures::get($name); - $this->_getAcceptance()->waitForText($price); - $this->_getAcceptance()->waitForElement($this->cardNumberInput); - $this->_getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); - $this->_getAcceptance()->selectOption($this->monthExpiredSelect, 12); - $this->_getAcceptance()->selectOption($this->yearExpiredSelect, date('Y')); - $this->_getAcceptance()->fillField($this->cvvCodeInput, $fixtures['CVC']); - $this->_getAcceptance()->click($this->continueButton); - - $this->_getAcceptance()->waitForPageLoad(); - $this->_getAcceptance()->waitForText($price); - $this->_getAcceptance()->waitForElement($this->continueButton); - $this->_getAcceptance()->click($this->continueButton); + $this->getAcceptance()->waitForText($price); + $this->getAcceptance()->waitForElement($this->cardNumberInput); + $this->getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); + $this->getAcceptance()->selectOption($this->monthExpiredSelect, 12); + $this->getAcceptance()->selectOption($this->yearExpiredSelect, date('Y')); + $this->getAcceptance()->fillField($this->cvvCodeInput, $fixtures['CVC']); + $this->getAcceptance()->click($this->continueButton); + + $this->getAcceptance()->waitForPageLoad(); + $this->getAcceptance()->waitForText($price); + $this->getAcceptance()->waitForElement($this->continueButton); + $this->getAcceptance()->click($this->continueButton); } /** * @return void */ - private function _checkBancontactPayment() + private function checkBancontactPayment() { - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } /** @@ -104,9 +104,9 @@ private function _checkBancontactPayment() public function checkMastercardPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Bancontact Mastercard payment works'); - $this->_prepareBancontactTest($I); - $this->_submitBancontactPayment('mastercard_payment'); - $this->_checkBancontactPayment(); + $this->prepareBancontactTest($I); + $this->submitBancontactPayment('mastercard_payment'); + $this->checkBancontactPayment(); } /** @@ -116,9 +116,9 @@ public function checkMastercardPaymentWorks(AcceptanceTester $I) public function checkVisaPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Bancontact Visa payment works'); - $this->_prepareBancontactTest($I); - $this->_submitBancontactPayment('visa_payment'); - $this->_checkBancontactPayment(); + $this->prepareBancontactTest($I); + $this->submitBancontactPayment('visa_payment'); + $this->checkBancontactPayment(); } /** @@ -128,8 +128,8 @@ public function checkVisaPaymentWorks(AcceptanceTester $I) public function checkMaestroPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Bancontact Maestro payment works'); - $this->_prepareBancontactTest($I); - $this->_submitBancontactPayment('maestro_payment'); - $this->_checkBancontactPayment(); + $this->prepareBancontactTest($I); + $this->submitBancontactPayment('maestro_payment'); + $this->checkBancontactPayment(); } } diff --git a/tests/Codeception/Acceptance/BaseCest.php b/tests/Codeception/Acceptance/BaseCest.php index 9c3c9c32..b794367d 100644 --- a/tests/Codeception/Acceptance/BaseCest.php +++ b/tests/Codeception/Acceptance/BaseCest.php @@ -25,7 +25,7 @@ abstract class BaseCest public function _before(AcceptanceTester $I): void { - foreach ($this->_getOXID() as $payment) { + foreach ($this->getOXID() as $payment) { $I->updateInDatabase( 'oxpayments', ['OXACTIVE' => 1], @@ -124,10 +124,7 @@ public function _after(AcceptanceTester $I): void $I->clearShopCache(); } - /** - * @return void - */ - protected function _initializeTest() + protected function initializeTest(): void { $miniBasketMenuElement = '//button[@class="btn btn-minibasket"]'; $this->I->openShop(); @@ -151,9 +148,9 @@ protected function _initializeTest() $this->I->waitForElement($miniBasketMenuElement); $this->I->waitForPageLoad(); - $this->_loginUser('client'); + $this->loginUser('client'); - $this->I->waitForElementClickable($miniBasketMenuElement); + $this->I->waitForElementClickable($miniBasketMenuElement, 15); $this->I->click($miniBasketMenuElement); $this->I->waitForText(Translator::translate('DISPLAY_BASKET')); @@ -164,15 +161,12 @@ protected function _initializeTest() $this->I->click(Translator::translate('CHECKOUT')); $this->I->waitForPageLoad(); - $this->I->waitForText(Translator::translate('NEXT')); + $this->I->waitForText(Translator::translate('NEXT'), 10); $this->I->click(Translator::translate('NEXT')); $this->I->waitForPageLoad(); } - /** - * @return void - */ - protected function _initializeSecuredTest() + protected function initializeSecuredTest(): void { $miniBasketMenuElement = '//button[@class="btn btn-minibasket"]'; $this->I->openShop(); @@ -196,7 +190,7 @@ protected function _initializeSecuredTest() $this->I->waitForElement($miniBasketMenuElement); $this->I->waitForPageLoad(); - $this->_loginUser('secured_client'); + $this->loginUser('secured_client'); $this->I->waitForElementClickable($miniBasketMenuElement); $this->I->click($miniBasketMenuElement); @@ -214,14 +208,10 @@ protected function _initializeSecuredTest() $this->I->waitForPageLoad(); } - /** - * @param string $type - * @return void - */ - protected function _loginUser(string $type) + protected function loginUser(string $type): void { $accountMenuButton = "//button[contains(@aria-label,'Usercenter')]"; - $openAccountMenuButton = "//form[@class='px-3 py-2']"; + $form = "//form[@class='px-3 py-2']"; $userLoginName = '#loginEmail'; $userLoginPassword = '#loginPasword'; $userLoginButton = '//button[@class="btn btn-primary"]'; @@ -232,10 +222,17 @@ protected function _loginUser(string $type) $this->I->waitForPageLoad(); $this->I->waitForElementVisible($accountMenuButton); $this->I->waitForElementClickable($accountMenuButton); - $this->I->click($accountMenuButton); - $this->I->waitForElementClickable($openAccountMenuButton); + $this->I->scrollTo($accountMenuButton); + $this->I->wait(10); + + try { + $this->I->click($accountMenuButton); + } catch (\Facebook\WebDriver\Exception\ElementClickInterceptedException $e) { + $this->I->makeScreenshot('cannotClickAccount'); + } + + $this->I->waitForElementClickable($form, 15); - //$this->I->waitForText(Translator::translate('MY_ACCOUNT')); $this->I->waitForElementVisible($userLoginName); $this->I->fillField($userLoginName, $clientData['username']); $this->I->fillField($userLoginPassword, $clientData['password']); @@ -243,11 +240,7 @@ protected function _loginUser(string $type) $this->I->waitForPageLoad(); } - /** - * @param string $label - * @return void - */ - protected function _choosePayment(string $label) + protected function choosePayment(string $label): void { $nextStepButton = '//button[@class="btn btn-highlight btn-lg w-100"]'; @@ -260,20 +253,14 @@ protected function _choosePayment(string $label) $this->I->waitForPageLoad(); } - /** - * @return void - */ - protected function _checkSuccessfulPayment() + protected function checkSuccessfulPayment(int $timeout = 5): void { $this->I->waitForDocumentReadyState(); $this->I->waitForPageLoad(); - $this->I->waitForText(Translator::translate('THANK_YOU')); + $this->I->waitForText(Translator::translate('THANK_YOU'), $timeout); } - /** - * @return void - */ - protected function _submitOrder() + protected function submitOrder(): void { $submitButton = '#submitOrder'; @@ -284,19 +271,10 @@ protected function _submitOrder() $this->I->waitForPageLoad(); } - /** - * @param AcceptanceTester $I - * @return void - */ - protected function _setAcceptance(AcceptanceTester $I) - { - $this->I = $I; - } - /** * @return AcceptanceTester */ - protected function _getAcceptance(): AcceptanceTester + protected function getAcceptance(): AcceptanceTester { return $this->I; } @@ -304,7 +282,7 @@ protected function _getAcceptance(): AcceptanceTester /** * @return string price of order */ - protected function _getPrice(): string + protected function getPrice(): string { $basketItem = Fixtures::get('product'); return Registry::getLang()->formatCurrency( @@ -315,35 +293,15 @@ protected function _getPrice(): string /** * @return string currency */ - protected function _getCurrency(): string + protected function getCurrency(): string { $basketItem = Fixtures::get('product'); return $basketItem['currency']; } - abstract protected function _getOXID(): array; - - /** - * If element is found return the text, if not return false - * @param $element - * @return bool - */ - protected function _grabTextFromElementWhenPresent($element, $I) - { - try { - $I->seeElement($element); - $isFound = $I->grabTextFrom($element); - } catch (\Exception $e) { - $isFound = false; - } - return $isFound; - } + abstract protected function getOXID(): array; - /** - * @param $element - * @return bool - */ - protected function _checkElementExists($element, $I) + protected function checkElementExists($element, $I): bool { try { $isFound = $I->seeElement($element); diff --git a/tests/Codeception/Acceptance/CreditCardCest.php b/tests/Codeception/Acceptance/CreditCardCest.php index 19a21ec3..0b799b1a 100644 --- a/tests/Codeception/Acceptance/CreditCardCest.php +++ b/tests/Codeception/Acceptance/CreditCardCest.php @@ -27,7 +27,7 @@ final class CreditCardCest extends BaseCest private $CVCInput = "//input[@id='card-ccv']"; private $toCompleteAuthentication = "Click here to complete authentication."; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_card']; } @@ -36,44 +36,44 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @return void */ - private function _prepareCreditCardTest(AcceptanceTester $I) + private function prepareCreditCardTest(AcceptanceTester $I) { - $this->_initializeTest(); + $this->initializeTest(); } /** * @param string $name Fixtures name * @return void */ - private function _submitCreditCardPayment(string $name) + private function submitCreditCardPayment(string $name) { - $this->_choosePayment($this->cardPaymentLabel); + $this->choosePayment($this->cardPaymentLabel); $fixtures = Fixtures::get($name); - $this->_getAcceptance()->waitForPageLoad(); - $this->_getAcceptance()->waitForElement($this->cardNumberIframe); - $this->_getAcceptance()->switchToIFrame($this->cardNumberIframe); - $this->_getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); - $this->_getAcceptance()->switchToNextTab(1); - $this->_getAcceptance()->switchToIFrame($this->expireDateIframe); - $this->_getAcceptance()->fillField($this->expireDateInput, '12/' . date('y')); - $this->_getAcceptance()->switchToNextTab(1); - $this->_getAcceptance()->switchToIFrame($this->CVCIframe); - $this->_getAcceptance()->fillField($this->CVCInput, $fixtures['CVC']); - $this->_getAcceptance()->switchToFrame(null); - - $this->_submitOrder(); + $this->getAcceptance()->waitForPageLoad(); + $this->getAcceptance()->waitForElement($this->cardNumberIframe); + $this->getAcceptance()->switchToIFrame($this->cardNumberIframe); + $this->getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); + $this->getAcceptance()->switchToNextTab(1); + $this->getAcceptance()->switchToIFrame($this->expireDateIframe); + $this->getAcceptance()->fillField($this->expireDateInput, '12/' . date('y')); + $this->getAcceptance()->switchToNextTab(1); + $this->getAcceptance()->switchToIFrame($this->CVCIframe); + $this->getAcceptance()->fillField($this->CVCInput, $fixtures['CVC']); + $this->getAcceptance()->switchToFrame(null); + + $this->submitOrder(); } /** * @return void */ - private function _checkCreditCardPayment() + private function checkCreditCardPayment() { - $this->_getAcceptance()->waitForText($this->toCompleteAuthentication, 60); - $this->_getAcceptance()->click($this->toCompleteAuthentication); + $this->getAcceptance()->waitForText($this->toCompleteAuthentication, 60); + $this->getAcceptance()->click($this->toCompleteAuthentication); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } /** @@ -81,10 +81,10 @@ private function _checkCreditCardPayment() * @param $flag int is oxarticles->OXSTOCKFLAG * @return void */ - private function _updateArticleStockAndFlag($stock, $flag) + private function updateArticleStockAndFlag($stock, $flag) { $article = Fixtures::get('product'); - $this->_getAcceptance()->updateInDatabase( + $this->getAcceptance()->updateInDatabase( 'oxarticles', ['OXSTOCK' => $stock, 'OXSTOCKFLAG' => $flag], ['OXID' => $article['id']] @@ -99,11 +99,11 @@ private function _updateArticleStockAndFlag($stock, $flag) public function checkPaymentUsingMastercardWorks(AcceptanceTester $I) { $I->wantToTest('Test Credit Card payment using Mastercard works'); - $this->_updateArticleStockAndFlag(15, 1); - $this->_prepareCreditCardTest($I); + $this->updateArticleStockAndFlag(15, 1); + $this->prepareCreditCardTest($I); - $this->_submitCreditCardPayment('mastercard_payment'); - $this->_checkCreditCardPayment(); + $this->submitCreditCardPayment('mastercard_payment'); + $this->checkCreditCardPayment(); } /** @@ -114,11 +114,11 @@ public function checkPaymentUsingMastercardWorks(AcceptanceTester $I) public function checkPaymentUsingMastercardWithLastStockItemWorks(AcceptanceTester $I) { $I->wantToTest('Test Credit Card payment using Mastercard with last stock item works'); - $this->_updateArticleStockAndFlag(1, 3); - $this->_prepareCreditCardTest($I); + $this->updateArticleStockAndFlag(1, 3); + $this->prepareCreditCardTest($I); - $this->_submitCreditCardPayment('mastercard_payment'); - $this->_checkCreditCardPayment(); + $this->submitCreditCardPayment('mastercard_payment'); + $this->checkCreditCardPayment(); } /** @@ -128,11 +128,11 @@ public function checkPaymentUsingMastercardWithLastStockItemWorks(AcceptanceTest public function checkPaymentUsingVisaWorks(AcceptanceTester $I) { $I->wantToTest('Test Credit Card payment using Visa works'); - $this->_updateArticleStockAndFlag(15, 1); - $this->_prepareCreditCardTest($I); + $this->updateArticleStockAndFlag(15, 1); + $this->prepareCreditCardTest($I); - $this->_submitCreditCardPayment('visa_payment'); - $this->_checkCreditCardPayment(); + $this->submitCreditCardPayment('visa_payment'); + $this->checkCreditCardPayment(); } /** @@ -143,11 +143,11 @@ public function checkPaymentUsingVisaWorks(AcceptanceTester $I) public function checkPaymentUsingVisaWithLastStockItemWorks(AcceptanceTester $I) { $I->wantToTest('Test Credit Card payment using Visa with last stock item works'); - $this->_updateArticleStockAndFlag(1, 3); - $this->_prepareCreditCardTest($I); + $this->updateArticleStockAndFlag(1, 3); + $this->prepareCreditCardTest($I); - $this->_submitCreditCardPayment('visa_payment'); - $this->_checkCreditCardPayment(); + $this->submitCreditCardPayment('visa_payment'); + $this->checkCreditCardPayment(); } /** diff --git a/tests/Codeception/Acceptance/EPSCest.php b/tests/Codeception/Acceptance/EPSCest.php index 1d1385ad..3061c527 100644 --- a/tests/Codeception/Acceptance/EPSCest.php +++ b/tests/Codeception/Acceptance/EPSCest.php @@ -32,7 +32,7 @@ final class EPSCest extends BaseCest private $listboxUl = '#listbox-container'; private $banknameInput = '#bankname'; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_eps']; } @@ -68,8 +68,8 @@ public function _after(AcceptanceTester $I): void public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test EPS payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->epsLabel); + $this->initializeTest(); + $this->choosePayment($this->epsLabel); $epsPaymentData = Fixtures::get('eps_payment'); @@ -81,7 +81,7 @@ public function checkPaymentWorks(AcceptanceTester $I) $I->waitForDocumentReadyState(); $I->waitForElement("//div[@data-value='" . $epsPaymentData["option"] . "']"); $I->click("//div[@data-value='" . $epsPaymentData["option"] . "']"); - $this->_submitOrder(); + $this->submitOrder(); // first page : login $I->waitForPageLoad(); @@ -112,6 +112,6 @@ public function checkPaymentWorks(AcceptanceTester $I) $I->waitForPageLoad(); $I->waitForDocumentReadyState(); $I->click($this->backlinkDiv); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/GiropayCest.php b/tests/Codeception/Acceptance/GiropayCest.php index 138c641e..0f5252dd 100644 --- a/tests/Codeception/Acceptance/GiropayCest.php +++ b/tests/Codeception/Acceptance/GiropayCest.php @@ -30,7 +30,7 @@ final class GiropayCest extends BaseCest private $TANLabel = "//input[@name='tan']"; private $yesButton = "//button[@id='yes']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_giropay']; } @@ -42,9 +42,9 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Giropay payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->giropayPaymentLabel); - $this->_submitOrder(); + $this->initializeTest(); + $this->choosePayment($this->giropayPaymentLabel); + $this->submitOrder(); $giropayPaymentData = Fixtures::get('giropay_payment'); @@ -64,12 +64,12 @@ public function checkPaymentWorks(AcceptanceTester $I) $I->waitForElement($this->continueButton); $I->click($this->continueButton); - $I->waitForText(str_replace(',', '.', $this->_getPrice())); + $I->waitForText(str_replace(',', '.', $this->getPrice())); $I->waitForElementClickable($this->continueButton); $I->wait(5); $I->click($this->continueButton); $I->wait(5); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/IDEALCest.php b/tests/Codeception/Acceptance/IDEALCest.php index d6d564b5..9256a1e3 100644 --- a/tests/Codeception/Acceptance/IDEALCest.php +++ b/tests/Codeception/Acceptance/IDEALCest.php @@ -49,7 +49,7 @@ public function _after(AcceptanceTester $I): void ); } - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_ideal']; } @@ -61,18 +61,18 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test iDEAL payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->idealPaymentLabel); + $this->initializeTest(); + $this->choosePayment($this->idealPaymentLabel); $idealPaymentData = Fixtures::get('ideal_payment'); - $price = str_replace(',', '.', $this->_getPrice()); + $price = str_replace(',', '.', $this->getPrice()); $I->scrollTo($this->paymentMethodForm); $I->wait(3); $I->waitForElement($this->paymentMethodForm); $I->click($this->paymentMethodForm); $I->click("//div[@data-value='" . $idealPaymentData["option"] . "']"); - $this->_submitOrder(); + $this->submitOrder(); // first page : put in bank name $I->waitForText($price); @@ -97,6 +97,6 @@ public function checkPaymentWorks(AcceptanceTester $I) $I->waitForElement($this->nextButton); $I->click($this->nextButton); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/InvoiceCest.php b/tests/Codeception/Acceptance/InvoiceCest.php index c26ac98e..519719c1 100644 --- a/tests/Codeception/Acceptance/InvoiceCest.php +++ b/tests/Codeception/Acceptance/InvoiceCest.php @@ -15,12 +15,13 @@ /** * @group unzer_module * @group ThirdGroup + * @group InvoiceCest */ final class InvoiceCest extends BaseCest { - private $invoicePaymentLabel = "//label[@for='payment_oscunzer_invoice_old']"; + private string $invoicePaymentLabel = "//label[@for='payment_oscunzer_invoice_old']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_invoice_old']; } @@ -32,18 +33,13 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @group InvoicePaymentTest */ - public function _checkPaymentWorks(AcceptanceTester $I) + public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Invoice (old) payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->invoicePaymentLabel); - $this->_submitOrder(); - - $this->_checkSuccessfulPayment(); - $I->waitForText(rtrim(strip_tags(sprintf( - Translator::translate('OSCUNZER_BANK_DETAILS_AMOUNT'), - $this->_getPrice(), - $this->_getCurrency() - )))); + $this->initializeTest(); + $this->choosePayment($this->invoicePaymentLabel); + $this->submitOrder(); + + $this->checkSuccessfulPayment(15); } } diff --git a/tests/Codeception/Acceptance/InvoiceSecuredCest.php b/tests/Codeception/Acceptance/InvoiceSecuredCest.php index c7582131..8ec9441f 100644 --- a/tests/Codeception/Acceptance/InvoiceSecuredCest.php +++ b/tests/Codeception/Acceptance/InvoiceSecuredCest.php @@ -15,12 +15,13 @@ /** * @group unzer_module * @group ThirdGroup + * @group InvoiceSecuredCest */ final class InvoiceSecuredCest extends BaseCest { - private $invoicePaymentLabel = "//label[@for='payment_oscunzer_invoice-secured']"; + private string $invoicePaymentLabel = "//label[@for='payment_oscunzer_invoice-secured']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_invoice-secured']; } @@ -29,18 +30,13 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @group InvoiceSecuredPaymentTest */ - public function _checkPaymentWorks(AcceptanceTester $I) + public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Invoice payment works'); - $this->_initializeSecuredTest(); - $this->_choosePayment($this->invoicePaymentLabel); - $this->_submitOrder(); - - $this->_checkSuccessfulPayment(); - $I->waitForText(rtrim(strip_tags(sprintf( - Translator::translate('OSCUNZER_BANK_DETAILS_AMOUNT'), - $this->_getPrice(), - $this->_getCurrency() - )))); + $this->initializeSecuredTest(); + $this->choosePayment($this->invoicePaymentLabel); + $this->submitOrder(); + + $this->checkSuccessfulPayment(15); } } diff --git a/tests/Codeception/Acceptance/PISCest.php b/tests/Codeception/Acceptance/PISCest.php index 5f02bc0d..6daabc36 100644 --- a/tests/Codeception/Acceptance/PISCest.php +++ b/tests/Codeception/Acceptance/PISCest.php @@ -27,7 +27,7 @@ final class PISCest extends BaseCest private $usertanInput = "//input[@id='XS2A-TAN']"; private $finishButton = "//a[@class='ui blue button back-btn']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_pis']; } @@ -42,18 +42,18 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @group PisPaymentTest */ - public function _checkPaymentWorks(AcceptanceTester $I) + public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test PIS payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->pisLabel); - $this->_submitOrder(); + $this->initializeTest(); + $this->choosePayment($this->pisLabel); + $this->submitOrder(); $pisPaymentData = Fixtures::get('pis_payment'); // first page : choose bank - $I->waitForText($this->_getPrice()); + $I->waitForText($this->getPrice()); $I->waitForElement($this->countrySelect); $I->selectOption($this->countrySelect, "DE"); $I->waitForElement($this->banknameInput); @@ -79,6 +79,6 @@ public function _checkPaymentWorks(AcceptanceTester $I) $I->waitForElement($this->finishButton); $I->click($this->finishButton); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/PayPalCest.php b/tests/Codeception/Acceptance/PayPalCest.php index 556171f5..28ba95f6 100644 --- a/tests/Codeception/Acceptance/PayPalCest.php +++ b/tests/Codeception/Acceptance/PayPalCest.php @@ -27,7 +27,7 @@ final class PayPalCest extends BaseCest private string $submitButton = "#payment-submit-btn"; private string $globalSpinnerDiv = "//div[@data-testid='global-spinner']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_paypal']; } @@ -38,10 +38,10 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I): void { $I->wantToTest('Test PayPal payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->paypalPaymentLabel); + $this->initializeTest(); + $this->choosePayment($this->paypalPaymentLabel); $I->makeScreenshot('order_filled'); - $this->_submitOrder(); + $this->submitOrder(); $paypalPaymentData = Fixtures::get('paypal_payment'); @@ -49,7 +49,7 @@ public function checkPaymentWorks(AcceptanceTester $I): void // accept cookies $I->waitForDocumentReadyState(); $I->wait(3); - if ($this->_checkElementExists($this->acceptAllCookiesButton, $I)) { + if ($this->checkElementExists($this->acceptAllCookiesButton, $I)) { $I->click($this->acceptAllCookiesButton); } @@ -65,13 +65,13 @@ public function checkPaymentWorks(AcceptanceTester $I): void // card choose page $I->waitForDocumentReadyState(); - $I->waitForText($this->_getPrice()); + $I->waitForText($this->getPrice()); $I->waitForElement($this->submitButton); $I->executeJS("document.getElementById('payment-submit-btn').click();"); $I->waitForDocumentReadyState(); $I->waitForElementNotVisible($this->globalSpinnerDiv, 60); $I->wait(10); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(30); } } diff --git a/tests/Codeception/Acceptance/PaylaterInvoiceCest.php b/tests/Codeception/Acceptance/PaylaterInvoiceCest.php index eca0167f..f323c347 100644 --- a/tests/Codeception/Acceptance/PaylaterInvoiceCest.php +++ b/tests/Codeception/Acceptance/PaylaterInvoiceCest.php @@ -21,7 +21,7 @@ final class PaylaterInvoiceCest extends BaseCest { private $invoicePaymentLabel = "//label[@for='payment_oscunzer_invoice']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_invoice']; } @@ -64,12 +64,12 @@ protected function fillB2Bdata(AcceptanceTester $I) public function checkPaymentB2CEURWorks(AcceptanceTester $I) { $I->wantToTest('PaylaterInvoice B2C EUR payment works'); - $this->_initializeSecuredTest(); - $this->_choosePayment($this->invoicePaymentLabel); + $this->initializeSecuredTest(); + $this->choosePayment($this->invoicePaymentLabel); $this->fillB2Cdata($I); - $this->_submitOrder(); + $this->submitOrder(); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(30); } /** @@ -85,11 +85,11 @@ public function checkPaymentB2BEURWorks(AcceptanceTester $I) ['oxcompany' => 'ACME'], ['oxid' => 'unzersecureuser'] ); - $this->_initializeSecuredTest(); - $this->_choosePayment($this->invoicePaymentLabel); + $this->initializeSecuredTest(); + $this->choosePayment($this->invoicePaymentLabel); $this->fillB2Bdata($I); - $this->_submitOrder(); + $this->submitOrder(); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(30); } } diff --git a/tests/Codeception/Acceptance/PaymentsAvailableCest.php b/tests/Codeception/Acceptance/PaymentsAvailableCest.php index fe61d6a6..3eb04285 100644 --- a/tests/Codeception/Acceptance/PaymentsAvailableCest.php +++ b/tests/Codeception/Acceptance/PaymentsAvailableCest.php @@ -135,7 +135,7 @@ private function switchCountry(AcceptanceTester $I, string $country): void } } - protected function _getOXID(): array + protected function getOXID(): array { return [ 'oscunzer_alipay', @@ -160,7 +160,7 @@ protected function _getOXID(): array public function checkPaymentsAvailable(AcceptanceTester $I) { $I->wantToTest('Test payment methods are available'); - $this->_initializeTest(); + $this->initializeTest(); foreach ($this->paymentMethodsByCountry as $country => $paymentMethods) { $this->switchCountry($I, $country); diff --git a/tests/Codeception/Acceptance/PrepaymentCest.php b/tests/Codeception/Acceptance/PrepaymentCest.php index c32db611..332110ff 100644 --- a/tests/Codeception/Acceptance/PrepaymentCest.php +++ b/tests/Codeception/Acceptance/PrepaymentCest.php @@ -20,7 +20,7 @@ final class PrepaymentCest extends BaseCest { private $prePaymentLabel = "//label[@for='payment_oscunzer_prepayment']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_prepayment']; } @@ -32,19 +32,19 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Prepayment payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->prePaymentLabel); - $this->_submitOrder(); + $this->initializeTest(); + $this->choosePayment($this->prePaymentLabel); + $this->submitOrder(); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); // This text doesn't appear on Thankye page for some reason, only in the email // possible ToDo: check the thank you page /* $I->waitForText(rtrim(strip_tags(sprintf( Translator::translate('OSCUNZER_BANK_DETAILS_AMOUNT'), - $this->_getPrice(), - $this->_getCurrency() + $this->getPrice(), + $this->getCurrency() )))); */ } diff --git a/tests/Codeception/Acceptance/Przelewy24Cest.php b/tests/Codeception/Acceptance/Przelewy24Cest.php index cf95c006..4ae98ef3 100644 --- a/tests/Codeception/Acceptance/Przelewy24Cest.php +++ b/tests/Codeception/Acceptance/Przelewy24Cest.php @@ -23,7 +23,7 @@ final class Przelewy24Cest extends BaseCest private $bankLink = "//div[@data-for='MBANK_-_MTRANSFER-0-0-tip']"; private $submitButton = "#user_account_pbl_correct"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_przelewy24']; } @@ -80,10 +80,10 @@ public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test Przelewy24 payment works'); - $this->_initializeTest(); + $this->initializeTest(); - $this->_choosePayment($this->przelewy24PaymentLabel); - $this->_submitOrder(); + $this->choosePayment($this->przelewy24PaymentLabel); + $this->submitOrder(); // first page : choose bank $I->waitForDocumentReadyState(); @@ -100,6 +100,6 @@ public function checkPaymentWorks(AcceptanceTester $I) // third page : expect end $I->waitForDocumentReadyState(); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/SEPADirectDebitCest.php b/tests/Codeception/Acceptance/SEPADirectDebitCest.php index b6649bc0..72a73ada 100644 --- a/tests/Codeception/Acceptance/SEPADirectDebitCest.php +++ b/tests/Codeception/Acceptance/SEPADirectDebitCest.php @@ -21,7 +21,7 @@ final class SEPADirectDebitCest extends BaseCest private $sepaPaymentLabel = "//label[@for='payment_oscunzer_sepa']"; private $IBANInput = "//input[contains(@id, 'unzer-iban-input')]"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_sepa']; } @@ -33,8 +33,8 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test SEPA Direct Debit payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->sepaPaymentLabel); + $this->initializeTest(); + $this->choosePayment($this->sepaPaymentLabel); $payment = Fixtures::get('sepa_payment'); $I->scrollTo($this->IBANInput); @@ -43,9 +43,9 @@ public function checkPaymentWorks(AcceptanceTester $I) $I->click("#oscunzersepaagreement"); $I->wait(1); - $this->_submitOrder(); + $this->submitOrder(); $I->wait(10); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/SEPADirectDebitSecuredCest.php b/tests/Codeception/Acceptance/SEPADirectDebitSecuredCest.php index 5a404fd0..015efba4 100644 --- a/tests/Codeception/Acceptance/SEPADirectDebitSecuredCest.php +++ b/tests/Codeception/Acceptance/SEPADirectDebitSecuredCest.php @@ -15,35 +15,35 @@ /** * @group unzer_module * @group SecondGroup + * @group SEPADirectDebitSecuredCest */ final class SEPADirectDebitSecuredCest extends BaseCest { - private $sepaPaymentLabel = "//label[@for='payment_oscunzer_sepa-secured']"; - private $IBANInput = "//input[contains(@id, 'unzer-iban-input')]"; + private string $sepaPaymentLabel = "//label[@for='payment_oscunzer_sepa-secured']"; + private string $IBANInput = "//input[contains(@id, 'unzer-iban-input')]"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_sepa-secured']; } /** * DEPRECATED / PAYMENT HAS BEEN REMOVED - * @param AcceptanceTester $I * @group SEPADirectSecuredPaymentTest */ - public function _checkPaymentWorks(AcceptanceTester $I) + public function checkPaymentWorks(AcceptanceTester $I): void { $I->wantToTest('Test SEPA Direct Debit payment works'); - $this->_initializeSecuredTest(); - $this->_choosePayment($this->sepaPaymentLabel); + $this->initializeSecuredTest(); + $this->choosePayment($this->sepaPaymentLabel); $payment = Fixtures::get('sepa_payment'); $I->fillField($this->IBANInput, $payment['IBAN']); $I->click("#oscunzersepaagreement"); $I->wait(1); - $this->_submitOrder(); + $this->submitOrder(); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } } diff --git a/tests/Codeception/Acceptance/ShopCest.php b/tests/Codeception/Acceptance/ShopCest.php index 04fb870e..2bf5ab46 100644 --- a/tests/Codeception/Acceptance/ShopCest.php +++ b/tests/Codeception/Acceptance/ShopCest.php @@ -19,7 +19,7 @@ */ final class ShopCest extends BaseCest { - protected function _getOXID(): array + protected function getOXID(): array { return []; } diff --git a/tests/Codeception/Acceptance/SofortCest.php b/tests/Codeception/Acceptance/SofortCest.php index dcccfd46..2c2fb172 100644 --- a/tests/Codeception/Acceptance/SofortCest.php +++ b/tests/Codeception/Acceptance/SofortCest.php @@ -15,14 +15,14 @@ /** * @group unzer_module * @group ThirdGroup + * @group SofortCest */ final class SofortCest extends BaseCest { private string $sofortPaymentLabel = "//label[@for='payment_oscunzer_sofort']"; private string $landSelect = "//select[@id='MultipaysSessionSenderCountryId']"; - private string $cookiesAcceptButton = "//button[@class='cookie-modal-accept-all button-primary']"; + private string $cookiesAcceptButton = "#Modal #modal-button-container .cookie-modal-accept-all"; private string $bankSearchInput = "//input[@id='BankCodeSearch']"; - private string $banksearchresultDiv = "//div[@id='BankSearcherResults']"; private string $bankLabel = "//label[@for='account-88888888']"; private string $accountNumberLabel = "//input[@id='BackendFormLOGINNAMEUSERID']"; private string $PINNumberLabel = "//input[@id='BackendFormUSERPIN']"; @@ -30,7 +30,7 @@ final class SofortCest extends BaseCest private string $kontoOptionInput = "//input[@id='account-1']"; private string $TANInput = "//input[@id='BackendFormTan']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_sofort']; } @@ -41,29 +41,27 @@ protected function _getOXID(): array public function checkPaymentWorks(AcceptanceTester $I): void { $I->wantToTest('Test Sofort payment works'); - $this->_initializeTest(); - $this->_choosePayment($this->sofortPaymentLabel); - $this->_submitOrder(); + $this->initializeTest(); + $this->choosePayment($this->sofortPaymentLabel); + $this->submitOrder(); $sofortPaymentData = Fixtures::get('sofort_payment'); // accept cookies - $I->waitForElement($this->cookiesAcceptButton); - $I->wait(1); - $I->canSeeAndClick($this->cookiesAcceptButton); + $I->waitForElementClickable($this->cookiesAcceptButton, 5); + $I->click($this->cookiesAcceptButton); // first page : choose bank $I->waitForPageLoad(); - $I->waitForText($this->_getPrice() . ' ' . $this->_getCurrency()); + $I->waitForText($this->getPrice() . ' ' . $this->getCurrency()); $I->selectOption($this->landSelect, 'DE'); - $I->waitForElement($this->bankSearchInput, 3); + $I->waitForElement($this->bankSearchInput, 5); $I->fillField($this->bankSearchInput, "Demo Bank"); - $I->wait(1); - $I->waitForElement($this->bankLabel); - $I->clickWithLeftButton($this->bankLabel); + $I->waitForElement($this->bankLabel, 3); + $I->click($this->bankLabel); // second page : put in account data - $I->waitForElement($this->accountNumberLabel); + $I->waitForElement($this->accountNumberLabel, 3); $I->fillField($this->accountNumberLabel, $sofortPaymentData['account_number']); $I->fillField($this->PINNumberLabel, $sofortPaymentData['USER_PIN']); $I->click($this->continueButton); @@ -79,6 +77,6 @@ public function checkPaymentWorks(AcceptanceTester $I): void $I->fillField($this->TANInput, $sofortPaymentData['USER_TAN']); $I->click($this->continueButton); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(15); } } diff --git a/tests/Codeception/Acceptance/WeChatPayCest.php b/tests/Codeception/Acceptance/WeChatPayCest.php index a772ded8..8b2f9277 100644 --- a/tests/Codeception/Acceptance/WeChatPayCest.php +++ b/tests/Codeception/Acceptance/WeChatPayCest.php @@ -21,7 +21,7 @@ final class WeChatPayCest extends BaseCest { private $wechatpayPaymentLabel = "//label[@for='payment_oscunzer_wechatpay']"; - protected function _getOXID(): array + protected function getOXID(): array { return ['oscunzer_wechatpay']; } @@ -30,30 +30,30 @@ protected function _getOXID(): array * @param AcceptanceTester $I * @group WechatpayPaymentTest */ - private function _prepareWechatpayTest(AcceptanceTester $I) + private function prepareWechatpayTest(AcceptanceTester $I) { - $this->_initializeTest(); + $this->initializeTest(); $I->scrollTo($this->wechatpayPaymentLabel); $I->wait(5); - $this->_choosePayment($this->wechatpayPaymentLabel); - $this->_submitOrder(); + $this->choosePayment($this->wechatpayPaymentLabel); + $this->submitOrder(); } /** * @param AcceptanceTester $I * @group WechatpayPaymentTest */ - private function _checkWechatpayPayment(int $methodNumber) + private function checkWechatpayPayment(int $methodNumber) { - $price = str_replace(',', '.', $this->_getPrice()); + $price = str_replace(',', '.', $this->getPrice()); $wechatpayClientData = Fixtures::get('wechatpay_client'); - $WechatpayPage = new LocalPaymentMethodsSimulatorPage($this->_getAcceptance()); + $WechatpayPage = new LocalPaymentMethodsSimulatorPage($this->getAcceptance()); $WechatpayPage->login($wechatpayClientData['username'], $wechatpayClientData['password'], $price); $WechatpayPage->choosePaymentMethod($methodNumber); $WechatpayPage->paymentSuccessful($price); - $this->_checkSuccessfulPayment(); + $this->checkSuccessfulPayment(); } /** @@ -63,8 +63,8 @@ private function _checkWechatpayPayment(int $methodNumber) public function checkWalletBalancePaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test WeChatPay Wallet Balance payment works'); - $this->_prepareWechatpayTest($I); - $this->_checkWechatpayPayment(1); + $this->prepareWechatpayTest($I); + $this->checkWechatpayPayment(1); } /** @@ -74,8 +74,8 @@ public function checkWalletBalancePaymentWorks(AcceptanceTester $I) public function checkSomeLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test WeChatPay Some LPM payment works'); - $this->_prepareWechatpayTest($I); - $this->_checkWechatpayPayment(2); + $this->prepareWechatpayTest($I); + $this->checkWechatpayPayment(2); } /** @@ -85,8 +85,8 @@ public function checkSomeLPMPaymentWorks(AcceptanceTester $I) public function checkAnotherLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test WeChatPay Another LPM Wechatpay payment works'); - $this->_prepareWechatpayTest($I); - $this->_checkWechatpayPayment(3); + $this->prepareWechatpayTest($I); + $this->checkWechatpayPayment(3); } /** @@ -96,7 +96,7 @@ public function checkAnotherLPMPaymentWorks(AcceptanceTester $I) public function checkOneMoreLPMPaymentWorks(AcceptanceTester $I) { $I->wantToTest('Test WeChatPay One more LPM Wechatpay payment works'); - $this->_prepareWechatpayTest($I); - $this->_checkWechatpayPayment(4); + $this->prepareWechatpayTest($I); + $this->checkWechatpayPayment(4); } } diff --git a/tests/Codeception/acceptance.suite.yml b/tests/Codeception/acceptance.suite.yml index 930d9d5f..f6cdfce0 100644 --- a/tests/Codeception/acceptance.suite.yml +++ b/tests/Codeception/acceptance.suite.yml @@ -14,7 +14,7 @@ modules: host: '%SELENIUM_SERVER_IP%' browser: '%BROWSER_NAME%' port: '%SELENIUM_SERVER_PORT%' - window_size: 1280x1000 + window_size: 1600x900 clear_cookies: true restart: true capabilities: diff --git a/tests/Integration/Model/UnzerPaymentModelDataTest.php b/tests/Integration/Model/UnzerPaymentModelDataTest.php index 765dfd7c..ffe2c254 100644 --- a/tests/Integration/Model/UnzerPaymentModelDataTest.php +++ b/tests/Integration/Model/UnzerPaymentModelDataTest.php @@ -7,8 +7,7 @@ class UnzerPaymentModelDataTest extends IntegrationTestCase { - /** @var string */ - private $paymentDataJson; + private string $paymentDataJson; public function setUp(): void { diff --git a/views/twig/extensions/themes/admin_twig/module_config.html.twig b/views/twig/extensions/themes/admin_twig/module_config.html.twig index ef703c28..cb466319 100644 --- a/views/twig/extensions/themes/admin_twig/module_config.html.twig +++ b/views/twig/extensions/themes/admin_twig/module_config.html.twig @@ -9,7 +9,7 @@ } {% if oModule.getInfo('id') == "osc-unzer" %} - {% set systemModeTrans = 'OSCUNZER_'|cat(systemMode)|translate %} + {% set systemModeTrans = ('OSCUNZER_' ~ systemMode) |translate %} {% if var_group == "unzerwebhooks" and module_var == "webhookConfiguration" %}
@@ -75,10 +75,10 @@ {% endif %}
- {% elseif module_var == systemMode|cat(" - applepay_merchant_cert_key") or module_var == systemMode|cat(" - applepay_merchant_cert") %} + {% elseif module_var == systemMode ~ "-applepay_merchant_cert_key" or module_var == systemMode ~ "-applepay_merchant_cert" %}
- {% if module_var == systemMode|cat(" - applepay_merchant_cert_key") %} + {% if module_var == systemMode ~ "-applepay_merchant_cert_key" %} @@ -94,7 +94,7 @@
- {% elseif module_var == systemMode|cat(" - applepay_merchant_identifier") %} + {% elseif module_var == systemMode ~ "-applepay_merchant_identifier" %} {# before we check the applepay_merchant_identifier, we have a upload-function for payment-key and payment-cert #} {% set hidePaymentProcessingTextareas = false %} {% if oView.getApplePayPaymentProcessingCertExists() and oView.getApplePayPaymentProcessingKeyExists() %} @@ -167,4 +167,4 @@ {% else %} {{ parent() }} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %}