Steps to get tests running
- Install all the things
- Fix PHP path mappings
- Configure phpunit
Mac:
brew install docker
brew install colima
- run
colima:
colima start --cpu 4 --memory 6 --disk 100 --vm-type=qemu --mount-type=sshfs --dns=1.1.1.1
Windows
Mac:
brew install ddev/ddev/ddev
mkcert -install
https://plugins.jetbrains.com/plugin/18813-ddev-integration
- cd ~/Sites
- mkdir my-drupal10-site
- cd my-drupal10-site
- ddev config --project-type=drupal10 --docroot=web --create-docroot
- ddev get ddev/ddev-selenium-standalone-chrome
- ddev start
- ddev composer create drupal/recommended-project
- ddev composer require drupal/core-dev --dev --update-with-all-dependencies
- ddev composer require drush/drush
- ddev drush site:install --account-name=admin --account-pass=admin -y
- ddev drush uli
- ddev launch
- Navigate to the root of your projct in a terminal
- ddev config --project-type=drupal10 --docroot=web # or another one of the project types
- ddev get ddev/ddev-selenium-standalone-chrome
- ddev composer require drupal/core-dev --dev --update-with-all-dependencies
- ddev start
ddev config --mutagen-enabled=true
ddev start
- In PhpStorm, open the project and open preferences
- Navigate to PHP
- Fix file paths by adding a new path mapping.
4. Local Path:
/Users/yourusername/Sites/my-drupal10-site
5. Remote Path:/var/www/html
- Navigate to PHP > Test Frameworks
- Add a new PHPUnit configuration and use the Remote PHP Interpreter that the DDEV plugin setup for you.
- Choose to find phpunit by PHAR file path.
- Set path to phpunit to be /var/www/html/vendor/bin/phpunit
- Set the configuration file to be /var/www/html/web/core/phpunit.xml.dist
- Unit
ddev exec phpunit -c /var/www/html/web/core/phpunit.xml.dist /var/www/html/web/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php
- Kernel
ddev exec phpunit -c /var/www/html/web/core/phpunit.xml.dist /var/www/html/web/core/modules/node/tests/src/Kernel/NodeAccessTest.php
- Functional
ddev exec phpunit -c /var/www/html/web/core/phpunit.xml.dist /var/www/html/web/core/modules/node/tests/src/Functional/NodeAccessCacheabilityWithNodeGrants.php
- FunctionalJavascript
ddev exec phpunit -c /var/www/html/web/core/phpunit.xml.dist /var/www/html/web/core/modules/node/tests/src/FunctionalJavascript/NodePreviewLinkTest.php
Navigate to each test file and click the green play button to run the test.