Magento 2 Get Current Module directory full path programmatically.

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

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, view or Controller. Continue reading “Magento 2 Get Current Module directory full path programmatically.”

Unit Test for Private and Protected Methods with PHPUnit Magento 2.

PHPUnit used to test your code coverage. You can easily write a Public method test case with PHPUnit.

Writing Unit Test case for private and protected methods in PHP language can cause trouble due to you can’t call private and protected methods directly But they should be tested using a different approach.

Using theĀ ReflectionMethod class invoke() method,
It’s possible to test both methods. In Magento Core code, few methods are tested with Private and Protected test case. Continue reading “Unit Test for Private and Protected Methods with PHPUnit Magento 2.”