Run module tests in OXID eShop 6

As follow up for Run tests for OXID eShop 6 here’s how to get module tests running for OXID eShop 6.

Let’s assume we have a metadata 2.0 module (own module namespace, installable with composer) in some public github repository (original or your own fork). Let’s use the OXIDProjects oxid-module-internals as example.

In case you just want to install the module and be good, check module’s or documentation about how to install via composer. Get your OXID VM up and do vagrant ssh.


cd /var/www/oxideshop
composer require oxid-community/moduleinternals

The module’s source code is downloaded into the vendor directory (vendor/oxid-community/moduleinternals).
As the shop still expects module source code to be located inside source/modules, the module’s composer.json contains an entry for the ‘target-directory’ in the extra section and the OXID composer plugin takes care all necessary files are copied into that target-directory.

"extra": {
    "oxideshop": {
      "target-directory": "oxcom/moduleinternals"

Best way if you want to actually develop the module is to directly git clone the module
into source/modules/target-directory.

cd /var/www/oxideshop/source/modules
git clone oxcom/moduleinternals

As you did not use the composer installation way, you need now to manually register the module’s namespace. Add the module namespace to the shop’s main composer.json, either into autoload or autoload-dev section. Make sure it points to the correct directory.

"autoload": {
    "psr-4": {
      "OxidCommunity\\ModuleInternals\\": "./source/modules/oxcom/moduleinternals"

Then do

cd /var/www/oxideshop
composer dump-autoload

Disregarding of you way of installation, doublecheck you have the module tests located
in source/modules/target-directory/Tests.

Edit the shop’s test_config.yml

 partial_module_paths: oxcom/moduleinternals
 run_tests_for_shop: false
 run_tests_for_modules: true

and run

cd /var/www/oxideshop


1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.