Test your component
Unit and Integration Tests
Run the PHPUnit based Magento unit and integration tests. See the Magento Testing Overview.
Functional testing
For further testing with the Magento functional testing frameworks, see [Functional Testing Framework] and Magento Functional Testing Framework.
Test using Magento Open Source
Test your component by deploying Magento Open Source and adding the component to the project’s composer.json
. To install, see Install using Composer.
1
2
3
4
"require": {
"magento/magento-composer-installer": "*",
"yourvendorname/module-one": "0.1.1"
},
Register your component, including the file location. Verify it works as expected, without compromising Magento functionality.
Test installing your component
Before you publish your component, test installing it using the Magento Component Manager. Access this feature through Web Setup Wizard in the Magento Admin.
- Package your component in a GitHub repository that is accessible by the machine on which you run the Magento Admin.
-
On that machine, create a static route from
https://repo.magento.com
to your GitHub repository.To create a static route, add a line similar to the following to your
hosts
file:1
<IP or hostname of your GitHub repository> https://repo.magento.com
- Install your component, like a merchant.
- Verify it installed correctly.
More information
See these resources for testing in PHP and validating Magento components:
- The Magento Coding Standard provides a set of rules and sniffs for the PHP_CodeSniffer tool
- Technical Deep Dive: How to Pass the Magento Marketplace Extension Quality Program (video) from Magento Imagine 2017
- Extension Quality Program in the Magento User Guide
- 01 The Module Skeleton Kata (video) by Mage2Katas