Skip to content

Latest commit

 

History

History
82 lines (58 loc) · 1.93 KB

README.md

File metadata and controls

82 lines (58 loc) · 1.93 KB

DDEV PHPUnit Demo

What is inside of this fork

How to use

  • Install DDEV
  • ddev start
  • Replace MODULE_NAME on following with name of your contrib module (use admin_toolbar).
  • mkdir -p repos; cd repos
  • git clone [email protected]:project/MODULE_NAME
  • cd ..
  • ddev composer install

Alternative way to include new modules.

  • ddev composer require drupal/MODULE_NAME
  • ddev composer drupal-contrib:switch-clone MODULE_NAME

PHPStan

To analyze using the distributed phpstan.neon.xml file:

phpstan web/modules/contrib/MODULE_NAME

to get more errors to fix, increase the level

phpstan web/modules/contrib/MODULE_NAME -l9

PHPCS

ddev phpcs web/modules/contrib/MODULE_NAME

PHPCBF

ddev phpcbf web/modules/contrib/MODULE_NAME

CSPell

cd web/core
ddev yarn install
ddev yarn run spellcheck ../modules/contrib/MODULE_NAME

ESlint

ddev eslint web/modules/contrib/MODULE_NAME
ddev eslint web/modules/contrib/MODULE_NAME --fix

Run PHPUnit tests

  • ddev phpunit --debug web/modules/contrib/MODULE_NAME
  • ddev phpunit --group MODULE_NAME

Other resources

Original readmd

See Running and debugging PHPUnit tests in PHPStorm with DDev and xdebug for a video demo covering configuration for running and debugging:

  • Unit tests
  • Kernel tests
  • Functional tests
  • FunctionalJavascript tests
  • Drupal Test Traits (ExistingSiteSelenium2DriverTest)