Skip to content

Commit

Permalink
fix: Missing dependencies / setup fails on new installations (#2509)
Browse files Browse the repository at this point in the history
* fix: Missing dependency for Magento_Customer module

Missing dependency may cause new installations to fail.

* fix: Use factory in Console Command

* fix: change from recurring schema to recurring data

* fix unit test

* fix unit test

---------

Co-authored-by: Bram <[email protected]>
Co-authored-by: Can Demiralp <[email protected]>
Co-authored-by: hossam-adyen <[email protected]>
  • Loading branch information
4 people authored Mar 7, 2024
1 parent 8785839 commit eade0a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 5 additions & 3 deletions Setup/Recurring.php → Setup/RecurringData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Adyen\Payment\Helper\PaymentMethods;
use Adyen\Payment\Helper\PaymentMethodsFactory;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class Recurring implements InstallSchemaInterface
class RecurringData implements InstallDataInterface
{
private PaymentMethodsFactory $paymentMethodsFactory;

Expand All @@ -19,7 +20,7 @@ public function __construct(
$this->paymentMethodsFactory = $paymentMethodsFactory;
}

public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$paymentMethods = $this->paymentMethodsFactory->create();
Expand All @@ -28,3 +29,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
$setup->endSetup();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@

namespace Adyen\Payment\Test\Unit\Setup;

use Adyen\Payment\Setup\Recurring;
use Adyen\Payment\Setup\RecurringData;
use Adyen\Payment\Test\Unit\AbstractAdyenTestCase;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Adyen\Payment\Helper\PaymentMethodsFactory;
use Adyen\Payment\Helper\PaymentMethods;

class RecurringTest extends AbstractAdyenTestCase
{
private Recurring $recurring;
private RecurringData $recurringData;

protected function setUp(): void
{
parent::setUp();
$this->paymentMethodsFactoryMock = $this->createGeneratedMock(PaymentMethodsFactory::class, ['create']);
$this->recurring = new Recurring($this->paymentMethodsFactoryMock);
$this->recurringData = new RecurringData($this->paymentMethodsFactoryMock);
}

public function testInstall()
Expand All @@ -39,9 +39,9 @@ public function testInstall()
$paymentMethods
->expects($this->once())
->method('togglePaymentMethodsActivation');
$setup = $this->createMock(SchemaSetupInterface::class);
$setup = $this->createMock(ModuleDataSetupInterface::class);
$context = $this->createMock(ModuleContextInterface::class);

$this->recurring->install($setup, $context);
$this->recurringData->install($setup, $context);
}
}
}
1 change: 1 addition & 0 deletions etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
<module name="Magento_Customer"/>
<module name="Magento_AdminNotification"/>
<module name="Magento_Vault"/>
<module name="Magento_Multishipping"/>
Expand Down

0 comments on commit eade0a7

Please sign in to comment.