From eade0a7243965e83d3b29aff26f67a19ced27e59 Mon Sep 17 00:00:00 2001 From: Pieter Zandbergen Date: Thu, 7 Mar 2024 09:36:11 +0100 Subject: [PATCH] fix: Missing dependencies / setup fails on new installations (#2509) * 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 Co-authored-by: Can Demiralp Co-authored-by: hossam-adyen <132500300+hossam-adyen@users.noreply.github.com> --- Setup/{Recurring.php => RecurringData.php} | 8 +++++--- .../{RecurringTest.php => RecurringDataTest.php} | 14 +++++++------- etc/module.xml | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) rename Setup/{Recurring.php => RecurringData.php} (73%) rename Test/Unit/Setup/{RecurringTest.php => RecurringDataTest.php} (76%) diff --git a/Setup/Recurring.php b/Setup/RecurringData.php similarity index 73% rename from Setup/Recurring.php rename to Setup/RecurringData.php index c324843bf..1b67f63f2 100644 --- a/Setup/Recurring.php +++ b/Setup/RecurringData.php @@ -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; @@ -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(); @@ -28,3 +29,4 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->endSetup(); } } + diff --git a/Test/Unit/Setup/RecurringTest.php b/Test/Unit/Setup/RecurringDataTest.php similarity index 76% rename from Test/Unit/Setup/RecurringTest.php rename to Test/Unit/Setup/RecurringDataTest.php index 02929115c..142f21b58 100644 --- a/Test/Unit/Setup/RecurringTest.php +++ b/Test/Unit/Setup/RecurringDataTest.php @@ -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() @@ -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); } -} \ No newline at end of file +} diff --git a/etc/module.xml b/etc/module.xml index 867f5452b..c7012dd87 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -17,6 +17,7 @@ +