## Creating Drupal projects by using DDEV. d9ddev () { if [ -z "$1" ] then check=$(shuf -n1 /usr/share/dict/words) shortened=${check::-2} varkeyname=${shortened,,} else varkeyname=$1 fi mkdir $varkeyname && cd $varkeyname ddev config --project-type=drupal9 --docroot=web --create-docroot yes | ddev composer create "drupal/recommended-project:^9" ddev composer require drush/drush drupal/admin_toolbar drupal/devel ddev exec drush si --site-name=$varkeyname --account-name=admin --account-pass=admin -y ddev drush en -y admin_toolbar admin_toolbar_tools admin_toolbar_search admin_toolbar_links_access_filter devel ddev drush cr ddev start && ddev launch } ## Prepares a Drupal 9 installation for testing with PHPUnit executing from project folder. d9phpunit () { varkeyname=basename $(pwd) string_url="" ddev composer require --dev phpunit/phpunit symfony/phpunit-bridge \ behat/mink-goutte-driver behat/mink-selenium2-driver \ phpspec/prophecy-phpunit --with-all-dependencies cd web/core cp phpunit.xml.dist phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's++'"$string_url"'+g' phpunit.xml cd ../.. ddev exec ./vendor/bin/phpunit -c web/core /var/www/html/web/modules/contrib/admin_toolbar } ## Same but for Drupal 8. d8phpunit () { varkeyname=basename $(pwd) string_url="" ddev composer require --dev phpunit/phpunit:^7 symfony/phpunit-bridge:^3.4.3 \ behat/mink-goutte-driver:^1.2 behat/behat:^3.4 behat/mink:^1.8 \ behat/mink-selenium2-driver:^1.5.0 --with-all-dependencies cd web/core cp phpunit.xml.dist phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's+++g' phpunit.xml sed -i 's++'"$string_url"'+g' phpunit.xml cd ../.. ddev exec ./vendor/bin/phpunit -c web/core /var/www/html/web/modules/contrib/admin_toolbar } ## Destroy a DDEV local deploy by name using in project folder. ddevdestroy () { varkeyname=basename $(pwd) ddev stop yes |ddev delete -O cd .. rm -rf $varkeyname }