Skip to content

Commit

Permalink
update tests for php8.1 and code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Dec 3, 2024
1 parent bc158cd commit d2066b5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
3 changes: 2 additions & 1 deletion Tests/Codeception/Acceptance/AbortAndCancelPaymentCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public function testUserClicksBrowserBackOnPaypal(AcceptanceTester $I)
// login page
$I->makeScreenshot("before_back");
$I->waitForElement($this->loginInput);
$I->amOnPage(Configuration::config()['modules']['config']['WebDriver']['url'] . $currentUrl);

$I->amOnPage($currentUrl);
$templateString = Translator::translate('OSCUNZER_CANCEL_DURING_CHECKOUT');
$I->wait(60);
$I->makeScreenshot("after_back");
Expand Down
1 change: 0 additions & 1 deletion Tests/Integration/Model/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace OxidSolutionCatalysts\Unzer\Tests\Integration\Model;


use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
Expand Down
6 changes: 6 additions & 0 deletions Tests/PhpStan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ parameters:
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Order::getUnzerInvoiceNr\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Order::setUnzerTransId\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Order::finalizeTmpOrder\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Payment::canCollectFully\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Payment::canCollectPartially\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Payment::canRefundFully\(\)#'

- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Payment::canRevertPartially\(\)#'
- '#Call to an undefined method OxidEsales\\Eshop\\Application\\Model\\Payment::isUnzerSecuredPayment\(\)#'
1 change: 0 additions & 1 deletion Tests/Unit/Service/BasketPayableServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\Eshop\Core\Registry;
use OxidSolutionCatalysts\Unzer\Core\UnzerDefinitions as CoreUnzerDefinitions;

use OxidEsales\Eshop\Application\Model\Basket;
use OxidSolutionCatalysts\Unzer\Service\BasketPayableService;
use PHPUnit\Framework\TestCase;
Expand Down
29 changes: 8 additions & 21 deletions src/Controller/Admin/AdminOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,42 +453,29 @@ public function isUnzerOrder(): bool

public function canCollectFully(): bool
{
if (!($this->oPayment instanceof Payment)) {
return false;
}

return $this->oPayment->canCollectFully();
}

public function canCollectPartially(): bool
{
if (!($this->oPayment instanceof Payment)) {
return false;
}

return $this->oPayment->canCollectPartially();
}

public function canRefundFully(): bool
{
if (!($this->oPayment instanceof Payment)) {
return false;
}

return $this->oPayment->canRefundFully();
}

public function canRefundPartially(): bool
{
if (!($this->oPayment instanceof Payment)) {
return false;
}

return $this->oPayment->canRefundPartially();
/** This is fix for phpStan */
/** @var \OxidSolutionCatalysts\Unzer\Model\Payment $payment */
$payment = $this->oPayment;
return $payment->canRefundPartially();
}

public function canRevertPartially(): bool
{
if (!($this->oPayment instanceof Payment)) {
return false;
}

return $this->oPayment->canRevertPartially();
}

Expand Down

0 comments on commit d2066b5

Please sign in to comment.