Skip to content

Integration tests create stub modules in app/code #12696

Closed
@Vinai

Description

@Vinai

When even a single integration test is executed, the following files and directories are created:

app/code/Magento
├── TestModuleDirectoryZipCodes
│   ├── etc
│   │   ├── module.xml
│   │   └── zip_codes.xml
│   └── registration.php
├── TestModuleFakePaymentMethod
│   ├── Gateway
│   │   └── Command
│   │       └── DoNothingCommand.php
│   ├── etc
│   │   ├── config.xml
│   │   ├── di.xml
│   │   └── module.xml
│   └── registration.php
└── TestModuleSample
    ├── composer.json
    ├── etc
    │   └── module.xml
    └── registration.php

(Note: the module Magento_TestModuleFakePaymentMethod is not generated in Magento 2.2.0).
This is a problem because running integration tests should not affect the installed Magento instance.

Preconditions

Reproduced on fresh installations of Magento 2.2.0 and 2.2.2. I haven't tried on Magento 2.2.1.

Steps to reproduce

  1. Install Magento, e.g. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition . and so on.
  2. Run all integration tests or create a custom module with nothing but a single integration test.
  3. Run the test, e.g. /var/www/example/vendor/phpunit/phpunit/phpunit --configuration /var/www/example/dev/tests/integration/phpunit.xml /var/www/example/app/code/Example/Foo/Test/Integration

Expected result

  1. Only the specified tests should run in isolation.
  2. Potential production code should not be affected.

Actual result

The modules are created in app/code/Magento potentially affect production code and are created independently if they are used in any test.

It should be possible to create the modules under dev/tests/integration/tmp in the sandbox directory and register them in the test process with the component registrar instead, leaving the app/code directory unmodified.

Metadata

Metadata

Assignees

Labels

Component: Framework/CodeFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions