2

I am starting to write our tests with PHPUnit on Drupal 8, and I am not sure about the best practices with the phpunit.xml.dist file. We separates the custom and the contrib modules using two directories in the /modules directory - /modules/custom and modules/contrib. The original phpunit.xml.dist file contains the following line <directory>../modules/*/tests/src/Unit</directory> so I had to add the <directory>../modules/*/*/tests/src/Unit</directory> directory.

I have another issue with sub-modules, our current structure is /modules/custom/main_custom_module/modules/sub_module, so I had to add another directory to the file (<directory>../modules/*/*/modules/*/tests/src/Unit</directory>).

What is the best practice when it comes to overriding the phpunit.xml.dist file? should I remove the file from VC (e.g. git,svn..)?

2
  • <directory>../modules/*/*/tests/src/Unit</directory> please file a core patch for this.
    – user49
    Commented Jun 21, 2015 at 17:26
  • That's a bug, see drupal.org/node/2499239.
    – Berdir
    Commented Jun 21, 2015 at 18:05

1 Answer 1

1

The right thing to do is to not add it to the core phpunit.xml.dist file. You have your own code, so you want to test that. The idea that core also tests contrib / custom code is not the right thing to do, IMHO

1
  • As far as I understand your opinion is the opposite to D8 and PHPUnit's guidelines
    – rreiss
    Commented Jun 21, 2015 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.