PHPUnit Test to check module is enable or not in Magento 2?

You can write a unit test for your module’s common function to check Module enables or not from a system configuration setting.

Every Professional third party Module contains the Is Active/Is Enable feature for a module from System -> Configuration settings.

To Check module is enable or not, you can write a common function in Helper file or any Common files. Continue reading “PHPUnit Test to check module is enable or not in Magento 2?”

Create customer address attribute Programmatically using Patch data in Magento 2.3

Create a customer address attribute programmatically in Magento 2 using the simple module by Best Coding Standard Approach using Setup patch data.

In our demo, I have created a simple text field attribute for a customer address called Nickname.

You can see a customer attribute in backend using Customer -> All Customer -> Click on Edit Customer Link.
Go to Addresses Tab and edit or add new Address. Continue reading “Create customer address attribute Programmatically using Patch data in Magento 2.3”

Magento 2 Get Current Module directory full path programmatically.

You can Retrieve a full path to a directory of a certain type within a module using Magento 2.

Using this article, When you need your current module path using programmatic way, You can fetch the current working module path by given code snippets.

Magento\Framework\Module\Dir and Magento\Framework\Module\Dir\Reader class used for getting the full path of Current modules any directory path like i18n, etc, Model,  Plugin, Helper,  API, view or Controller folder. Continue reading “Magento 2 Get Current Module directory full path programmatically.”