3

Is there any way I can run unit testing only for my modules? I know there is a way to run a specific unit test but I want to run unit test for all tests under certain directory (/modules/custom in my case). Is it even possible? I want to do it so that CI/CD automatically runs unit tests only for my code.

4

Sure, all you need to do is provide a path/file to phpunit and it will be limited to that.

vendor/bin/phpunit -c core modules/custom
  • tired this but running into an issue: Declaration of Drupal\Tests\BrowserTestBase::assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) must be compatible with PHPUnit\Framework\Assert::assertEquals($expected, $actual, string $message = '', float $delta = 0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void in /var/www/drupal/web/core/tests/Drupal/Tests/BrowserTestBase.php on line 44 any idea what that is? I am guessing some versions issues (durpal 8.5.3). – awm Jun 13 '18 at 17:45
  • was versions issue. I had to downgrade phpunit to 4.8.36 on php 7.1 and d 8.5.3 – awm Jun 15 '18 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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